Range content but not single pages [SOLVED]


#1

Sorry if this is a silly question, but I’m lost.

Content folder

content
  companies
    company1.md
    company2.md
  posts
    post1.md
    post2.md
  about.md

Layout folder

_default
  section.html
  single.html
about
  single.html
index.html

In index.html, I’m using {{range .Data.Pages}}to loop through the companies and posts folders. But it’s also picking up the about.md file and giving an error. How do I exclude the about.md file from index.html? As I need to generate other single pages, is there a better way than just excluding each individual file? Thanks!


#2

Whenever you ask for help involving an error message, include the error message.

Search for something like range exclude.


#3

Use where and query for section (or type, which is in most cases the same).


#4

Thanks for this. Solved my problem.