<ul><!--{% for item in include.menu %}
- --><li class="{{ item.class }}"><a class="{{ item.class }}" href="{{ site.baseurl }}{{ item.url | replace: '/index.html','/' }}">{{ item.title }}</a></li><!--
+ --><li class="{{ item.class }}"><a class="{{ item.class }}" href="{{ site.baseurl }}{{ item.url }}">{{ item.title }}</a></li><!--
{% if item.sub %}
--><li class="sub">{% include menu-level.html menu=item.sub %}</li><!--
{% endif %}
{% if page.excerpt %}<meta name="description" content="{{ page.excerpt | newline_to_br | replace:'<br />',' ' | strip_html | strip_newlines | truncate: 192 }}">{% endif %}
<link rel="stylesheet" href="{{ site.baseurl }}/style.css">
- <link rel="canonical" href="{{ site.url }}{{ site.baseurl }}{{ page.url | replace:'/index.html','/' }}">
+ <link rel="canonical" href="{{ site.url }}{{ site.baseurl }}{{ page.url }}">
{% if page.rss %}
<link rel="alternate" type="application/atom+xml" title="{{ site.blog.title }}" href="{{ site.baseurl }}/blog/feed.xml" />
{% if page.category %}<link rel="alternate" type="application/atom+xml" title="{{ site.blog.title }} • {{ title }}" href="{{ site.baseurl }}{{ page.url | replace: '.html','.xml' }}" />{% endif %}
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), layout)
- self.data['category'] = category
+ self.data['category'] = category # this tells the site template to add a link to the RSS feed
category_title_prefix = site.config['blog']['category_title_prefix'] || 'Category: '
self.data['title'] = "#{category_title_prefix}#{category.capitalize}"
module MenuFilter
def menu(input, displayurl)
def create_menu(pages, base, displayurl)
+ # URLs in `base`, `displayurl`, `cururl` are normalized to remove trailing slashes. This is to be able to distinguish the root of a folder from its children by the number of slashes in the URL.
+ # We need this to treat the root of a folder as a direct child of the parent folder, whereas pages within a subfolder are of course grandchildren.
result = Array.new
for page in pages
- cururl = page['url'].sub('/index.html', '')
+ cururl = page['url'].chomp('/')
+ # Test if this page is a non-hidden *direct* child of `base`
if cururl.start_with?(base) and cururl.count('/') == base.count('/') and (not page['hide'])
# figure out CSS class
if cururl == displayurl
end
# store menu node
result.push(menu_node)
+ else
+ #print "Not adding: cur=", cururl, ", base=", base, ", hide=", page['hide'], "\n"
end
end
# sort the result before returning it
result.sort_by { |page| [page['sort'], page['url']] }
end
- create_menu(input, "", displayurl.sub('/index.html', ''))
+ create_menu(input, "", displayurl.chomp('/'))
end
end
end