Skip to content

Instantly share code, notes, and snippets.

@tokkonopapa
Created January 2, 2012 00:30
Show Gist options
  • Save tokkonopapa/1548796 to your computer and use it in GitHub Desktop.
Save tokkonopapa/1548796 to your computer and use it in GitHub Desktop.
SEOに効くOctopressの隠し機能
{% capture description %}{% if page.description %}{{ page.description }}{% else %}{{ content | raw_content }}{% endif %}{% endcapture %}
<meta name="description" content="{{ description | strip_html | condense_spaces | truncate:150 }}">
{% if page.keywords %}<meta name="keywords" content="{{ page.keywords }}">{% endif %}
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/&/,'&amp;')}\""
post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
post.puts "comments: true"
post.puts "categories: "
post.puts "description: "
post.puts "keywords: "
post.puts "---"
end
@tokkonopapa
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment