Creating a "table of contents"

29 views
Skip to first unread message

Justin Wong

unread,
Dec 14, 2022, 5:29:50 PM12/14/22
to nanoc
Trying to do something simple -- just create an index.md page for a directory.

content/articles/index.md: 

```
<% @items.find_all('./*').sort_by { |a| a[:title] }.each do |a| %>
  *<%= link_to a[:title], a %></li>
<% end %>
```

And under content/articles/ is a couple of .md files with content

Am I misunderstanding the semantic way to do this sort of thing in nanoc?

Thanks

Denis Defreyne

unread,
Dec 17, 2022, 4:58:41 AM12/17/22
to noreply-spamdigest
Hey there,

That looks correct.

Also make sure that you’ve set up the rules so that the `/articles/index.md` item is using the :erb filter.

Best,

--
You received this message because you are subscribed to the Google Groups "nanoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nanoc+un...@googlegroups.com.

Justin Wong

unread,
Jan 17, 2023, 1:09:33 AM1/17/23
to nanoc
Thanks for confirming that was right!

That led me down the path of realising I didn't actually include the LinkTo helper.

lib/tags.rb: 
`use_helper Nanoc::Helpers::LinkTo`

Best,
Justin
Reply all
Reply to author
Forward
0 new messages