Normally I blog in Turkish, which is my native language. From now on, I’ll
try to keep it simple and post as much as I can about my development interests
in English with this lovely blogging engine called: Octopress.
I’m a Python / Django developer. I’m building web
application. I’ve seen many tweets about Octopress, especially developers was
telling that how Octopress is flexible for posting code examples and snippets.
Yes It is true!
It is insanely true that Octopress is a great and simple blogging engine for
developers. Its written in Ruby. If you are familiar to the Ruby world like
Sinata, Jekyll, Sass, Yaml everthing
will be easier than.
Don’t worry, you really don’t need to know any of those terms. Just read and
follow the steps which is mentioned in the Octopress Docs.
I just did few tweaks to customize my own website. Also, i rapidly created a
TextMate bundle too. Check out Octopress TextMate Bundle.
My Version of Octopress
I’ve added another layout called: plain. Normally, you need to:
Create New Page
1
rake new_page[filename]
Right now, if you pass second parameter, which is is_plane_page, creates
plain page layout.
---
layout: default
---
<div><articlerole="article"> {% if page.title %}
<header><h1class="entry-title">{% if site.titlecase %}{{ page.title | titlecase }}{% else %}{{ page.title }}{% endif %}</h1> {% if page.date %}<pclass="meta">{% include post/date.html %}{{ time }}</p>{% endif %}
</header> {% endif %}
{{ content }}
{% unless page.footer == false %}
<footer> {% if page.date or page.author %}<pclass="meta"> {% if page.author %}{% include post/author.html %}{% endif %}
{% include post/date.html %}{% if updated %}{{ updated }}{% else %}{{ time }}{% endif %}
{% if page.categories %}{% include post/categories.html %}{% endif %}
</p>{% endif %}
{% unless page.sharing == false %}
{% include post/sharing.html %}
{% endunless %}
</footer> {% endunless %}
</article>{% if site.disqus_short_name and page.comments == true %}
<section><h1>Comments</h1><divid="disqus_thread"aria-live="polite">{% include post/disqus_thread.html %}</div></section>{% endif %}
</div>{% unless page.sidebar == false %}
{% unless page.asides == false %}
<asideclass="sidebar"> {% include_array asides %}
</aside> {% endunless %}
{% endunless %}
If you check line 35, you’ll see the page.asides variable. My plain page
layout allows you to add page based asides. Now you can change asides in every
page you like to.
Here is my Rakefile tweak, just did this small change:
My Custom Rakefile diff (octopress-layout-plain-Rakefile.diff)download
--- Rakefile 2011-12-21 23:35:10.000000000 +0200+++ Rakefile-mine 2011-12-21 23:34:18.000000000 +0200@@ -1,8 +1,9 @@ # usage rake new_page[my-new-page] or rake new_page[my-new-page.html] or rake new_page (defaults to "new-page.markdown")
-desc "Create a new page in #{source_dir}/(filename)/index.#{new_page_ext}"-task :new_page, :filename do |t, args|+desc "Create a new page (or plain page) in #{source_dir}/(filename)/index.#{new_page_ext}"+task :new_page, :filename, :is_plane_page do |t, args| raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
args.with_defaults(:filename => 'new-page')
+ args.with_defaults(:is_plane_page => '') page_dir = [source_dir]
if args.filename.downcase =~ /(^.+\/)?(.+)/
filename, dot, extension = $2.rpartition('.').reject(&:empty?) # Get filename and extension
@@ -24,12 +25,22 @@ puts "Creating new page: #{file}"
open(file, 'w') do |page|
page.puts "---"
- page.puts "layout: page"- page.puts "title: \"#{title}\""- page.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"- page.puts "comments: true"- page.puts "sharing: true"- page.puts "footer: true"+ if args.is_plane_page.length > 0+ page.puts "layout: plain"+ page.puts "title: \"#{title}\""+ page.puts "comments: false"+ page.puts "sharing: false"+ page.puts "footer: false"+ page.puts "sidebar:"+ page.puts "asides:"+ else+ page.puts "layout: page"+ page.puts "title: \"#{title}\""+ page.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"+ page.puts "comments: true"+ page.puts "sharing: true"+ page.puts "footer: true"+ end page.puts "---"
end
else
Well, my next plan is to find out how to add language/locale support for date
object. Month names, day names and all the other string based things are
need to be customizable via _config.yml (I belive)