Show
Ignore:
Timestamp:
04/19/08 11:36:07 (4 months ago)
Author:
seancribbs
Message:

Add <r:meta /> tag and appropriate fields to pages table.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/radiant/app/models/standard_tags.rb

    r815 r826  
    647647  end 
    648648   
     649  desc %{ 
     650    The namespace for 'meta' attributes.  If used as a singleton tag, both the description 
     651    and keywords fields will be output as &lt;meta /&gt; tags unless the attribute 'tag' is set to 'false'. 
     652     
     653    *Usage*: 
     654     
     655    <pre><code> <r:meta [tag="false"] />  
     656     <r:meta> 
     657       <r:description [tag="false"] /> 
     658       <r:keywords [tag="false"] /> 
     659     </r:meta> 
     660    </code></pre> 
     661  } 
     662  tag 'meta' do |tag| 
     663    if tag.double? 
     664      tag.expand 
     665    else 
     666      tag.render('description', tag.attr) + 
     667      tag.render('keywords', tag.attr) 
     668    end 
     669  end 
     670   
     671  desc %{ 
     672    Emits the page description field in a meta tag, unless attribute 
     673    'tag' is set to 'false'. 
     674     
     675    *Usage*: 
     676     
     677    <pre><code> <r:meta:description [tag="false"] /> </code></pre> 
     678  } 
     679  tag 'meta:description' do |tag| 
     680    show_tag = tag.attr['tag'] != 'false' || false 
     681    description = CGI.escapeHTML(tag.locals.page.description) 
     682    if show_tag 
     683      "<meta name=\"description\" content=\"#{description}\" />" 
     684    else 
     685      description 
     686    end 
     687  end 
     688 
     689  desc %{ 
     690    Emits the page keywords field in a meta tag, unless attribute 
     691    'tag' is set to 'false'. 
     692     
     693    *Usage*: 
     694     
     695    <pre><code> <r:meta:keywords [tag="false"] /> </code></pre> 
     696  }   
     697  tag 'meta:keywords' do |tag| 
     698    show_tag = tag.attr['tag'] != 'false' || false 
     699    keywords = CGI.escapeHTML(tag.locals.page.keywords) 
     700    if show_tag 
     701      "<meta name=\"keywords\" content=\"#{keywords}\" />" 
     702    else 
     703      keywords 
     704    end     
     705  end 
     706   
    649707  private 
    650708