Disable taxonomy list and single pages

Hi there,

I have an authors folder (taxonomy) under content so I can link an author to a blog post. However, I don’t want to use the list, single pages and for them to show up in the sitemap yet.
In essence, I don’t want Hugo to render /authors and /authors/myname.

I’ve tried:

Adding the following to _index.md under /content/authors

---
_build:
  list: false
  render: false
cascade:
  _build:
    list: false
    render: false
---

Adding disable kinds to config.yaml

disableKinds: [ "taxonomy", "taxonomyTerm", "term" ]
ignoreErrors: [ "error-disable-taxonomy" ]
taxonomies:
    category: ""
    tags: ""
    author: "authors"

Appreciate the help in advance.

I suggest you to left taxonomy parameter empty on your front matter

---
...
category:
tags:
author:
---

Thanks for your suggestion but I’m afraid that didn’t work.

I’m a bit confused. How can you link a blog post to an author if you don’t render a page for the author?

Hiding them from the sitemap is a different exercise, easily accomplished by overriding the sitemap template.

Thanks for your reply @jmooring
For my first iteration of a website, I don’t want to use list or single pages nor to have a link to the author, just to have them in their own content folder and display their names on the posts.

Is there no way to disable these pages from rendering? Otherwise, I will have to remove them after Hugo as been built and modify the sitemap template, feel like there’s a smarter way.

If each post has a different author, just add the author directly to the post’s front matter. Then you can call {{ .Params.author }} in your template, and maybe wrap it in a <span> element,

I did think about that, but each author has photos etc and extra front matter that would be good to be included in their respective content folders.

content/authors/_index.md

+++
title = 'Authors'
date = 2023-02-27T13:01:45-08:00
draft = false
[_build]
render = 'never'
[cascade._build]
render = 'never'
+++

When I build the site:

public/
├── authors/
│   └── jmooring/
│       └── portrait.jpg
├── posts/
│   ├── post-1/
│   │   └── index.html
│   ├── index.html
│   └── index.xml
├── favicon.ico
├── index.html
├── index.xml
└── sitemap.xml

Neither the sitemap nor the XML feel contain any entries for authors.

But if you do something like this in your single.html template…

{{ with .GetTerms "authors" }}
  <p>Authors:
    {{ range . }}
      <a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
      {{ with .Resources.Get "portrait.jpg" }}
        <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
      {{ end }}
    {{ end }}
  </p>
{{ end }}

The anchor link will look like a link, but doesn’t go anywhere. So don’t make it a link.

1 Like

Thanks @jmooring !

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