I’m attempting to list the names of .md files on a certain page. They must match a certain category (seen below). However, I want the place of the category below (visualdesign) to change based on what the current page title is. For instance, the page that this code is located on is called “Tabs”, I want the category in the code below to change to “tabs”. I’ve tried {{ .Title }} in the place of .visualdesign. Though, I receive an error in my terminal and half of the live webpage disappears.
Here’s the code (located in /layouts/_default/single.html):
<div id="block-menu">
<a href="/Workforce-StyleGuide/" class="top" style="font-weight: bold;">{{ .Title }}</a><br>
{{ range first 100 .Site.Taxonomies.categories.visualdesign}}
<a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a><br>
{{ end }}
</div>
Yeah, it took me several hours to figure it out. For what I read in your OP I think this approach is what you’re looking for. If you read that post completely, you may find the way to achive what you’re looking for. Specially this post
Or hang in there for my post in tips and tricks
Hmm, yeah I’ve tried that. However I receive an error in the Terminal:
ERROR 2017/08/03 17:52:19 Error while rendering "page": template: theme/_default/single.html:51:18: executing "theme/_default/single.html" at <.Params.tags>: range can't iterate over test
Is there another way to grab the title of the category? Like .Page.Title?
… Can’t post more that x-number of replies my first day on here I figured it out lol. {{ . }} didn’t know that was the output function. All good now. This solved my 6-hour issue. I can post my final snippet in Tips and Tricks if you’d guys like. Thanks again for all of your help