Prevent tag directories from rendering, allow items to be included in content blocks

I have several directories which contain tagged content pieces, like features, testimonials, faqs, etc. Here is how the frontmatter looks at one of the examples:

---
title: "Otto M."
date: 2021-01-09T21:30:52+01:00
draft: false
weight: 1
type: testimonial
tags: 
- review_manager
---

##### Great features, fast and intuitive interface, happy customer.

This file resides in:

|- content
   |- testimonials 
      | testimonial_1.en.md
      | testimonial_[X].[lang].md

Right now the pages are being rendered and included in the sitemaps, which is not intended. If I include an _index.md or _index.en.md in the “testimonials” directory and add this frontmatter to it (and nothing else):

---
title: 
cascade:
  build:
    render: never
    list: always
---

it does stop rendering unwanted pages, but then the template will have zero range for this tag in a loop like this:

				{{ range .Site.Taxonomies.tags.review_manager }}
				<div class="testimonial">
					{{ .Content }}
					<p><span>{{ .Title }}</span></p>
				</div>
				{{ end }}

My config/hugo.toml includes

[taxonomies]
	tag = "tags"

I have to use tags, as the contents is being reused in different places and .Site.Taxonomies.tags seems to fit this purpose well.

It sounds like you want this instead:

content/testimonials/_index.md

cascade:
  build:
    render: link
    list: never

With the above:

  • Testimonial pages are not published
  • The testimonial section page is not published
  • Testimonial pages will not appear in any lists, including the sitemap and RSS feeds
  • Taxonomy terms assigned to testimonial pages are included in the taxonomy, and their relationship to the testimonial pages is maintained
1 Like

Thanks, jmooring! This support forum would be very different without your help.

1 Like

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