Avoid generating a path

Hey all!

I’m making a review section on my home page. The reviews are placed in /content/reviews as markdownfiles (e.g. review1.md, review2.md). This works great as I can access the content in a loop on my homepage:

		<div class="tiles">
			{{ range (where .Site.RegularPages "Section" "reviews" | first 5) }}
			<div class="tile">
				<p>{{ .Content }}</p>
				<em>{{ .Params.author }}</em>
			</div>
			{{ end }}
		</div>

However, this also generates a baseURL/reviews path (due to the name of the reviews dir in the content dir). How can I avoid this path from being generated?

I’ve looked at Build Options | Hugo but I can’t get it to work. Where should the front-matter in that example be coded?

The headless front matter key also doesn’t seems to work.

you write it inside content/reviews/_index.md

1 Like

Thanks @pamubay! For reference, this is the _index.md I’ve used:

_build:
  render: false
cascade:
  _build:
    list: true
    render: false
title: Reviews

Setting the _build.render: false prevents generating a path to reviews.

Note: I was struggling a bit because the browser cached the /reviews path. When trying this, make sure it’s not cached.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.