Skip to content

Need a blog-oritend tutorial / sample git repo / template #296

@chengguangnan

Description

@chengguangnan

I'm in favor of nanoc, however I found that there are no offical tutorial on how to make a blog with nanoc. The tutorial which I found in Google is also 12 years old.

I'm a Ruby web developer and have used site generators before, but it still takes some trial and error to setup a blog. I think setting up a blog should be a very smooth experience.

I think provide a blog-oritend sample project git repo would be very helpful. I might provide one later.

Below are the changes that I have to make to make my first blog site running:

# Rules
compile '/**/*.html' do
  filter :erb
....

compile '/**/*.md' do
  filter :kramdown
  layout '/default.*'
  write item.identifier.without_ext + '.html'
end
# lib/default.rb
use_helper Nanoc::Helpers::Blogging
use_helper Nanoc::Helpers::LinkTo
# content/index.html
<% sorted_articles.each do |post| %>
  <div class='post'>
    <h1><%= link_to post[:title], post.path %></h1>
    <aside>Posted at: <%= post[:created_at] %></aside>
    <article>
      <%= post.compiled_content %>
    </article>
  </div>
<% end %>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions