R:link and hosting multiple sites off a single radiant insta


#1

After reading the suggestion at
http://dev.radiantcms.org/radiant/wiki/HowToHostMultipleWebsites

I tried setting up just such a system. It largely works; however,
unsurprisingly the r:link tag is thoroughly confused. As radiant does
not know that apache is “rehoming” all of its tags, I get goofed up
links.

If I am missing something and there is an easy way around this
problem, please let me know. If not one thing that is working for me
is this simple patch against r:link, allowing for a “base” option that
is removed from the front of the url.

Thanks for Radiant
pth

Index: /Users/phurley/mental/radiant/app/models/standard_tags.rb

— /Users/phurley/mental/radiant/app/models/standard_tags.rb (revision
233)
+++ /Users/phurley/mental/radiant/app/models/standard_tags.rb (working
copy)
@@ -340,10 +340,13 @@
tag ‘link’ do |tag|
options = tag.attr.dup
anchor = options[‘anchor’] ? “##{options.delete(‘anchor’)}” : ‘’

  • base = options[‘base’] ? options.delete(‘base’) : nil
    attributes = options.inject(’’) { |s, (k, v)| s <<
    %{#{k.downcase}="#{v}" } }.strip
    attributes = " #{attributes}" unless attributes.empty?
    text = tag.double? ? tag.expand : tag.render(‘title’)
  • %{<a href="#{tag.render(‘url’)}#{anchor}"#{attributes}>#{text}}
  • url = tag.render(‘url’)
  • url = url.sub(/^#{base}/,’’) if base
  • %{<a href="#{url}#{anchor}"#{attributes}">#{text}}
    end

desc %{ <r:breadcrumbs [separator=“separator_string”] />