Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable single page output for designated sections #3612

Closed
budparr opened this issue Jun 19, 2017 · 14 comments
Closed

Disable single page output for designated sections #3612

budparr opened this issue Jun 19, 2017 · 14 comments
Assignees
Milestone

Comments

@budparr
Copy link

budparr commented Jun 19, 2017

As of Hugo 0.23 there is no way to designate a section of content to not output to single page while simultaneously use that content in other contexts of the site.

For a generic example, if I have a section called "authors," but do not want each author to have their own page on the site, yet I do want to use the entries on article pages or an aggregate/list "authors" page.

Data files are currently the most non-hackish way of accomplishing this, However, data files are not necessarily the best format for every type of content, particularly for content creators who may find it easier to create and manage discrete documents.

I think the best way to accomplish this would be configuration variable, such as disableOutput = ['section-name', 'another-section]

I'm not sure if disableOutput is descriptive enough to capture that it's only skipping single pages. I used this to be consistent with disableKinds.

@bep bep changed the title Feature Request: Disable single page output for designated sections Disable single page output for designated sections Jun 19, 2017
@bep
Copy link
Member

bep commented Jun 19, 2017

I assume Permalink etc. would return blank for these pages? So they should not be in sitemap, .Site.Pagesetc., only in the section's page list?

@budparr
Copy link
Author

budparr commented Jun 19, 2017

Yes. I was thinking that Sitemap would be separate a separate issue, but what you say looks like a logical conclusion to me.

@budparr
Copy link
Author

budparr commented Jun 19, 2017

It may not be important at this point, but perhaps disableOutput should be disableSections though still not sure that's descriptive enough.

@bep
Copy link
Member

bep commented Jun 19, 2017

I was thinking that Sitemap would be separate a separate issue

It cannot be a separate issue. We have nothing to link to in this case (no file on disk), so it would be confusing to put them in sitemap etc.

@bep bep removed the Wish label Jun 26, 2017
@bep bep added this to the v0.25 milestone Jun 26, 2017
@bep bep self-assigned this Jun 27, 2017
@bep
Copy link
Member

bep commented Jun 27, 2017

@budparr can you look at the start of my proposal in #3651 and consider if that could cover the needs described in this issue?

@budparr
Copy link
Author

budparr commented Jun 27, 2017

Thanks for thinking of this. Honestly I don't understand "bags" so much yet. Seems like a higher level grouping than sections to include images, as far as I can tell.

All I want is to have a section not create single pages while still using the content elsewhere (list view). Perhaps each "bag" having its own configuration file is the point here, and I suppose that would work.

@bep bep modified the milestones: v0.25, v0.26 Jul 5, 2017
@bep bep modified the milestones: v0.26, v0.27 Aug 6, 2017
@budparr
Copy link
Author

budparr commented Aug 7, 2017

I'm currently using this hack as posted in the forums:

If layouts/foo/single.html and layouts/section/foo.html are zero-length, no files will be published for section foo, but the content can still be retrieved through taxonomies, etc. This was briefly broken in 0.20-0.20.2, but was fixed in 0.20.3.

This works for me as of Hugo 0.26.

@bep bep added this to the v0.30 milestone Sep 26, 2017
@bep bep modified the milestones: v0.30, v0.31 Oct 13, 2017
@ianbrandt
Copy link

Could this be generalized to include disabling single page output for individual content files (presumably via front matter), or should that be a separate issue?

For background see: https://discourse.gohugo.io/t/how-not-to-render-content-as-a-page/2208/3

@bep
Copy link
Member

bep commented Oct 18, 2017

Could this be generalized to include disabling single page output for individual content files (presumably via front matter),

It would be natural that this issue would cover both.

I have deliberately waited with this issue until I see how my page bundle branch turns out (that has taken more time than planned), which will give you some sort of "virtual pages", example:

ls /blog/my-article
index.md
pretty-picture.png
some-content.md
some-more-content.md

In the above (in how the world looks to me right now), index.md will be the "index content file" with references to a set of resources (range .Resources will list all).

The big question is: Should all of these resources be "permalinkable"?

  • The image: Yes.
  • The "some more content". Probably not. You most likely want to use those as building blocks for the main page.

@bep bep modified the milestones: v0.31, v0.32 Oct 30, 2017
@bep bep modified the milestones: v0.32, v0.33 Dec 16, 2017
@MadeByMike
Copy link

Disabling whole sections is one thing but would it not also make sense to do this on a per page basis in Front Matter?

Something like:

+++
disableOutput = true
+++

An example of this might be a blog that also references external content. Whilst you could have different sections this it results in a lot of duplication and complex joins on ranges and this isn't good for content management or development.

Personally I'd be more than happy if .RelPermalink and similar properties were blank when this was used and it was up to developer to override the sitemap, rss or other templates where you might not want these items to appear.

@bep bep modified the milestones: v0.33, v0.34 Jan 11, 2018
@bep bep modified the milestones: v0.34, v0.35 Jan 22, 2018
@bep
Copy link
Member

bep commented Jan 22, 2018

This will be handled by #4311

@bep bep closed this as completed Jan 22, 2018
@kaushalmodi
Copy link
Contributor

Couldn't this already be handled using section/branch bundle organization?

@kaushalmodi
Copy link
Contributor

By "this", I mean the feature request that @budparr originally made.

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants