You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys... I asked this question in Hugo discourse and it was suggested I ask here as well.
I know the theme isn't really designed to have the homepage be a content page, it is a blog theme after all. But I would very much like to have a setup where the homepage is a content page. Simplest answer to this issue would be to write an index html that pulls content from the single page.md. But of course this would break the theme layout.
So looking through the files I put together my own index.html from pieces of code from the theme... but I can't get the homepage to look right. The home page does not show my TOC and displays front matter data that I turned off in my markdown file. But if I click on the page link from the menu, it renders it correctly. Below is my code as well as pictures of what I expect to happen versus what is happening;
{{ define "body-class" }}
article-page
{{/*
Enable the right sidebar if
- Widget different from 'TOC' is enabled
- TOC is enabled and not empty
*/}}
{{- $HasWidgetNotTOC := false -}}
{{- $TOCWidgetEnabled := false -}}
{{- range .Site.Params.widgets.page -}}
{{- if ne .type "toc" -}}
{{ $HasWidgetNotTOC = true -}}
{{- else -}}
{{ $TOCWidgetEnabled = true -}}
{{- end -}}
{{- end -}}
{{- $TOCManuallyDisabled := eq .Params.toc false -}}
{{- $TOCEnabled := and (not $TOCManuallyDisabled) $TOCWidgetEnabled -}}
{{- $hasTOC := ge (len .TableOfContents) 100 -}}
{{- .Scratch.Set "TOCEnabled" (and $TOCEnabled $hasTOC) -}}
{{- .Scratch.Set "hasWidget" (or $HasWidgetNotTOC (and $TOCEnabled $hasTOC)) -}}
{{ end }}
{{ define "main" }}
<article class="{{ if .Params.image }}has-image {{ end }}main-article">
{{ partial "article/components/header" . }}
<section class="article-content">
{{ with .Site.GetPage "page/portfolio" }}
{{ .Content }}
{{ end }}
</section>
{{ partial "article/components/footer" . }}
</article>
{{ partialCached "footer/footer" . }}
{{ partialCached "article/components/photoswipe" . }}
{{ end }}
{{ define "right-sidebar" }}
{{ if .Scratch.Get "hasWidget" }}{{ partial "sidebar/right.html" (dict "Context" . "Scope" "page") }}{{ end}}
{{ end }}
This is what I expect the homepage to look like
This is what it actually looks like;
It looks like AmanRathoreP have done something similar based on his answer in the discussion by Edembey; #1039 But his version still doesn't look like what I expect mine to look like.
Anyways, If anyone can help me figure this out, it would be awesome. Thanks.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys... I asked this question in Hugo discourse and it was suggested I ask here as well.
I know the theme isn't really designed to have the homepage be a content page, it is a blog theme after all. But I would very much like to have a setup where the homepage is a content page. Simplest answer to this issue would be to write an index html that pulls content from the single page.md. But of course this would break the theme layout.
So looking through the files I put together my own index.html from pieces of code from the theme... but I can't get the homepage to look right. The home page does not show my TOC and displays front matter data that I turned off in my markdown file. But if I click on the page link from the menu, it renders it correctly. Below is my code as well as pictures of what I expect to happen versus what is happening;
This is what I expect the homepage to look like

This is what it actually looks like;

It looks like AmanRathoreP have done something similar based on his answer in the discussion by Edembey; #1039 But his version still doesn't look like what I expect mine to look like.
Anyways, If anyone can help me figure this out, it would be awesome. Thanks.
Beta Was this translation helpful? Give feedback.
All reactions