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

Cannot .Render a section page from the homepage layout. #3398

Closed
aroig opened this issue Apr 26, 2017 · 10 comments
Closed

Cannot .Render a section page from the homepage layout. #3398

aroig opened this issue Apr 26, 2017 · 10 comments

Comments

@aroig
Copy link
Contributor

aroig commented Apr 26, 2017

I would like to render a copy of a section page as the homepage. To that end have a layout/index.html that looks like this:

{{- with .Site.GetPage "section" "about" }}
{{- .Render "single" }}
{{- end }}

Where "about" is a section page with content from an _index.md file.

The thing worked for a while, but after a recent update to hugo 0.20 it produces a blank page.

@bep
Copy link
Member

bep commented Apr 26, 2017

This is duplicate of #3245

I'm not sure how well this worked in earlier Hugo; you may wait and see if we implement this for Hugo 0.21 -- but I would recommend that you refactor your templates (a section page is not a single page).

@bep bep added the Duplicate label Apr 26, 2017
@rdwatters
Copy link
Contributor

Huh. My comment didn't show up @aroig I apologize. I'm having interstitial connectivity here at work. (This has also never happened before.) Didn't mean to close without commenting, but if you want some support on this, please visit the forums at https://discuss.gohugo.io .

@aroig
Copy link
Contributor Author

aroig commented Apr 26, 2017

@bep Thanks, I missed that one.

@rdwatters Ok, If I have anything to ask I'll go to the forums, but I'm pretty sure that this is either a regression or a feature request, depending on how you look at it.

I don't think there is currently a way in hugo to have a layout template to copy the contents of an other page, without http redirects, and without copying the contents of the template.

By the way, being able to use block templates for the homepage would help.

@bep
Copy link
Member

bep commented Apr 26, 2017

  1. You could use a partial which feels much more natural to me.
  2. Block templates for home page works fine.

But now we are borderline what is best solved on the discussion forum: https://discuss.gohugo.io/

@rdwatters I deleted your comment as I was typing my reply ...

@rdwatters
Copy link
Contributor

By accident or was there something wrong with my reply? 😄

@bep
Copy link
Member

bep commented Apr 26, 2017

I marked it as a duplicate, hence it is a "valid issue"; I only send people to the discussion site for issue that can not be resolved here (i.e. questions).

@rdwatters
Copy link
Contributor

Got it.

@aroig
Copy link
Contributor Author

aroig commented Apr 26, 2017

  1. You could use a partial which feels much more natural to me.

Yes, that is what I'll do. I preferred a full {{ .Render }} or block template because even with partials there is a small amount of duplication. But I guess can live with that.

  1. Block templates for home page works fine.

Hmm... I can't make them work. They render empty for the home page.

Thanks.

@aroig
Copy link
Contributor Author

aroig commented Apr 26, 2017

Hmm... I can't make them work. They render empty for the home page.

Please, disregard that. They do work indeed. I must have been doing something wrong on the earlier tests. I'm sorry.

@github-actions
Copy link

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 21, 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

3 participants