matt
matt

Reputation: 787

Is there a way to have Hugo not generate URLs for each post?

This sounds bonkers, but I really do mean than I don't want Hugo to generate URLs.

What I'm trying to achieve is a Google News type site (but much worse). In the front matter of each post I'd record an external URL as a custom variable and spit that out into my template. There'd be no content in each "post" and therefore I don't want to generate a URL nor an entry in a sitemap.

My research tells me I can do the sitemap part by making my own template. Kudos to Dereck Curren and his guide.

I can't figure out how I'd stop Hugo from generating a URL entry at all.

Any ideas?

Upvotes: 2

Views: 1117

Answers (2)

Razvan Nicu
Razvan Nicu

Reputation: 116

Set headless: true (check official documentation).

Upvotes: 3

n m
n m

Reputation: 1791

This is not bonkers and there are plans to build nolist and norender into Hugo.[*]

For now, the way I do this with my bookmark lists is to have a layouts/bookmarks/single.html file that is empty (0 bytes). In content/bookmarks/whatever.md I have something like this:

---
# draft: true
title: "github.com: Issues · gohugoio/hugo"
link: "https://github.com/gohugoio/hugo/issues?utf8=%E2%9C%93&q=is%3Aissue"
tag:
  - gohugo
  - bookmark
---

Then I use the tag (taxonomy features) of Hugo, along with .Params.link to display the links. This is how I create the the "On other sites" section of my portals, for example my #gohugo Portal.

[*]: Add nolist and norender · Issue #6412 · gohugoio/hugo · GitHub

Upvotes: 1

Related Questions