fix issue #90
This commit is contained in:
parent
d31f1f959a
commit
d4b7734003
7
doc/TODO
7
doc/TODO
@ -23,12 +23,13 @@ x bushido changes in the master
|
||||
? edit sidebar (inline editor). Unable to reset it
|
||||
x SEO: support and support/ should be 2 different pages. Remove trailing slash
|
||||
x issue #91: httparty
|
||||
- issue #90: seo metadata
|
||||
x issue #90: seo metadata
|
||||
- Has_one => group by in the select
|
||||
- convert existing templates (the 2 of the themes section)
|
||||
- better hints:
|
||||
- notify the user that after changing the page title, they still have to click "update" for the change to be saved
|
||||
-
|
||||
|
||||
- created_by ASC => "Creation date ascending"
|
||||
- bug heroku: unable to upload a new file
|
||||
|
||||
BACKLOG:
|
||||
|
||||
|
@ -10,9 +10,11 @@ module Locomotive
|
||||
}
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
# Removes whitespace and quote charactets from the input
|
||||
def sanitized_string(string)
|
||||
string.strip.gsub(/"/, '')
|
||||
string ? string.strip.gsub(/"/, '') : ''
|
||||
end
|
||||
|
||||
def meta_description(context)
|
||||
|
@ -1,11 +1,13 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Locomotive::Liquid::Tags::SEOMetadata do
|
||||
|
||||
let(:site) do
|
||||
Factory.build(:site, :meta_description => 'A short site description', :meta_keywords => 'test only cat dog')
|
||||
end
|
||||
|
||||
describe 'rendering' do
|
||||
|
||||
it 'renders a a meta description tag' do
|
||||
render_seo_metadata.should include '<meta name="description" content="A short site description" />'
|
||||
end
|
||||
@ -23,8 +25,14 @@ describe Locomotive::Liquid::Tags::SEOMetadata do
|
||||
site.meta_keywords = ' one " two " three '
|
||||
render_seo_metadata.should include '<meta name="keywords" content="one two three" />'
|
||||
end
|
||||
|
||||
|
||||
it 'renders an empty string if no meta' do
|
||||
site.meta_keywords = nil
|
||||
render_seo_metadata.should include '<meta name="keywords" content="" />'
|
||||
end
|
||||
|
||||
context "when page" do
|
||||
|
||||
context "has metadata" do
|
||||
let(:page) { site.pages.build(:meta_keywords => 'hulk,gamma', :meta_description => "Bruce Banner") }
|
||||
subject { render_seo_metadata('page' => page) }
|
||||
@ -33,14 +41,15 @@ describe Locomotive::Liquid::Tags::SEOMetadata do
|
||||
end
|
||||
|
||||
context "does not have metadata" do
|
||||
let(:page) { site.pages.build }
|
||||
let(:page) { site.pages.build }
|
||||
subject { render_seo_metadata('page' => page) }
|
||||
it { should include(%Q[<meta name="keywords" content="#{site.meta_keywords}" />]) }
|
||||
it { should include(%Q[<meta name="description" content="#{site.meta_description}" />]) }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context "when content instance" do
|
||||
|
||||
let(:content_type) do
|
||||
Factory.build(:content_type, :site => site).tap do |ct|
|
||||
ct.content_custom_fields.build :label => 'anything', :kind => 'String'
|
||||
@ -62,9 +71,9 @@ describe Locomotive::Liquid::Tags::SEOMetadata do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def render_seo_metadata(assigns={})
|
||||
|
||||
def render_seo_metadata(assigns = {})
|
||||
registers = { :site => site }
|
||||
liquid_context = ::Liquid::Context.new({}, assigns, registers)
|
||||
output = Liquid::Template.parse("{% seo_metadata %}").render(liquid_context)
|
||||
|
Loading…
Reference in New Issue
Block a user