Skip to content
Daniel edited this page Apr 12, 2017 · 1 revision

We can collect some small and short snippets in this page.

Show tags, feeds in navigation bar depending on URL

I run a small homepage where I present some general information. This homepage includes a small blog with the prefix /blog/. I set the variables posts-index-uri and permalink accordingly:

# (...)
permalink = /blog/{year}/{month}/{day}/{title}/index.html
# (...)
posts-index-uri = /blog/index.html
# (...)

After that I wanted the "Tags", "Atom", "RSS" links to appear only on the blog posts. Therefore I made the following small addition to page-template.html:

<!-- ... -->
	    @(when (string-prefix? uri-path (string-append uri-prefix "/blog/"))	
            @list{<li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                Tags <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="@|uri-prefix|/index.html">All Posts</a></li>
                @|tags-list-items|
              </ul>
            </li>
            <li><a href="@|atom-feed-uri|">Atom</a></li>
            <li><a href="@|rss-feed-uri|">RSS</a></li>})
<!-- ... -->
Clone this wiki locally