Hello all!
I discovered Middleman a couple of weeks, and I’d like to use it for blogging.
My only questions so far are these:
Can posts be their own subdirectory in source/
? Inside the activate :blog do |blog|
I have
blog.prefix = "posts"
blog.permalink = "posts/{year}-{month}-{day}-{title}.html"
# Matcher for blog source files
blog.sources = "posts/{year}-{month}-{day}-{title}.html"
and in source
I made a posts
directory. And on that same note, is it necessary to place a posts.html.erb
file inside of that directory?
Second question: Bulma-like pagination, how to? Basing from what their docs say on pagination, I’d imagine it’d be sane to do it like so
<% if paginate && num_pages > 1 %>
<nav class="pagination">
<% if prev_page %%>
<%= link_to 'Previous', prev_page, :class => 'pagination-previous' %>
<% end %>
<% if paginate %>
<ul class="pagination-list">
<% [1...articles.length].each do |n| %>
<li>
<a class="pagination-link" href="<%= page_link %>"><%= n %></a>
</li>
<% end %>
</ul>
<% end %>
<% if paginate %>
<% if next_page %>
<%= link_to 'Next', next_page, :class => 'pagination-next' %>
<% end %>
<% end %>
</nav>
<% else %>
<br />
<% end %>
I grabbed articles.length
from what was listed here.
And here’s my entire blog section of my config.rb
if that helps.
activate :blog do |blog|
# This will add a prefix to all links, template references and source paths
blog.prefix = "posts"
blog.permalink = "posts/{year}-{month}-{day}-{title}.html"
# Matcher for blog source files
blog.sources = "posts/{year}-{month}-{day}-{title}.html"
blog.taglink = "categories/{tag}.html"
# blog.layout = "layout"
blog.summary_separator = /(READMORE)/
blog.summary_length = 250
# blog.year_link = "{year}.html"
# blog.month_link = "{year}/{month}.html"
# blog.day_link = "{year}/{month}/{day}.html"
# blog.default_extension = ".markdown"
blog.tag_template = "tag.html"
blog.calendar_template = "calendar.html"
# Enable pagination
blog.paginate = true
blog.per_page = 5
blog.page_link = "page/{num}"
end
Thanks for any help/advice/tips you give!