Closed aparcar closed 4 years ago
Hi @aparcar, thank you for getting in touch 👍🏻 😄.
Is it possible to disable the
Home
-page?
Sure. Anything's possible with Hugo
😜 . Here's an idea:
Place a nav.html
into your local layouts/partials
-directory to overwrite the menu from the navigation layout of this template. E.g. you could simply put <a href="{{ "/" | relURL }}">Blog</a>
in there or leave it empty completely...
Then, set the url
-parameter on your local content/blog/_index.md
-file to "/"
, i.e.:
+++
title = "Blog"
url = "/"
+++
🎸 With that, your blog posts will render directly under https://aparcar.gitlab.io.
I hope that helps.
Let me know if you have any other/follow-up questions.
Greetings to Hawaii 🌞 😄 , Jan
Hi, I have the following things:
<!-- layouts/partials/nav.html -->
<a href="{{ "/" | relURL }}">Blog</a>
<a href="{{ "/about" | relURL }}">About</a>
<!-- content/blog/_index.md -->
+++
title = "Blog"
url = "/"
+++
But my home page only show the menu of "blog" and "about", not the menu and the list of blog posts. Something I'm missing? Sorry first time Hugo.
Hi @huyvohcmc, thank you for reaching out 😸.
I am not 100% sure what you mean by »not the menu«, but I'll outline what I think would be best. Then, feel free to provide more details on what you are trying to achieve if what I propose does not work out for you 🧑🏭.
So here's the deal.
I think it would be best to use Hugo Menus.
That means your layouts/partials/nav.html
will be
{{ range .Site.Menus.main }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
Then, to make any page (i.e. /content/*.md
or content/blog/*.md
) appear on the menu, you simply add
menu = "main"
to its frontmatter, e.g. your /content/blog/_index.md
.
If you want to have more control over the ordering you can use the Weight
-param. To make the Blog
the first item on the menu, you could e.g. place
+++
title = "Blog"
url = "/"
[menu]
[[menu.main]]
weight = 0
+++
inside your /content/blog/_index.md
-file.
From what you said, I'm assuming (feel free to correct otherwise 😺) you also have a /content/about.md
-file which you want to place on the menu. To to do that you would add
+++
title = "About"
[menu]
[[menu.main]]
weight = 10
+++
to your /content/about.md
-file.
With url = "/"
inside your /content/blog/_index.md
-file your homepage should render the list of blogposts, i.e. the list of files inside your content/blog/
-folder.
I hope that helps. Let me know if it does.
Kind regards to Ho Chi Minh City, Vietnam 👋🏻, Jan
It works! Thank you @janraasch for the nice explanation.
Sure. Have fun with your »Bear Blog« 💯 👋🏻 .
Hi!
Thanks for the great theme!
I'm having a strange problem. I followed your instructions here to use the blog list page as home. The issue is that sometimes I get a blank page on the home section and sometimes I get the blog list. It's completely random.
I don't have a content/_index.md
file and my blog/_index.md
contains:
+++
title = "Blog"
url = "/"
[menu]
[menu.main]
identifier = "blog"
weight = 1
+++
My website is at https://alabhyajindal.com and the source code is at https://github.com/alabhyajindal/aj, if you want to take a look.
Hi @alabhyajindal, thank you so much for reaching out, let's continue on ➡️ https://github.com/janraasch/hugo-bearblog/issues/79.
I'd like to skip the usage of
Home
and only use theBlog
feature. Is it possible to disable toHome
page?