Selective output from Page Bundles?

Is there a way to control whether a file in a Page Bundle gets published?

When I delete pages on my site, I want them not simply disappeared (as in HTTP 404), but gone (as in HTTP 410)—for various reasons, but mostly because it’s the Right Thing™ to do. So instead of removing the source files I add

deleted = true

to the FrontMatter and have such pages processed differently by templates.

With Page Bundles, this results in auxillary files (images, etc.) still ending up on the site. Of course, I’d rather the images and other auxillary stuff from deleted pages would get removed from the site as well.

To achieve this I currently leverage Apache by having a custom output format and templates to create an .htaccess file in deleted page’s directory. However, I don’t really like being dependent on Apache, especially since this bars me from moving my site to Netlify, GitHub Pages, or (which I actually intend to do eventially) IPFS.

Is there a way (or a plan for a feature) to forbid files from bundles appearing on the site using Hugo proper? should help, I think (see the publishResources flag).

1 Like

Yep, thank you, publishResources = false is exactly the solution when made at the root level using FM Cascade.

This has an unpleasant side-effect of clearing homepage’s .Date, but that’s another question, I guess.

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