How to add a list of content from another section?

Hello, I have two folders Course and Notes:




How can I list the content from note1 to the template file of course1?

Is it possible? Any Ideas? Thanks!

1 Like

I only have hints for you that you might be able to hack together for a solution.

During the page rendering, you have access to .Site.Pages, which is all of the pages for your site. You should be able to find the page you’re looking for using where and range. Each Page should have a .Content property that you can insert into the current page.

As far as I know, there’s no {{ getPage "" }} helper function available in templates to make this easy.


That is me. Yes, you would have to filter from the “all pages” list:

{{ where .Site.Pages “Section” “=” “mySection” )

Above totally untested, but should work.

1 Like

Oh right, in templates other than the homepage, you have to range over .Site.Pages, and not .Data.Pages. Thanks @bep! Works like a charm.

1 Like