Opening post gives 404
alexsaaf opened this issue · comments
I am using the example site provided with the theme, but when I click the title of a post I get 404. The url is for example: http://localhost:1313/posts/background-image/. I generated the page and within posts, there are no html files for the individual posts.
Does the theme not have a way to show a single post (Similarly to how it can display the About page) ? I might just be doing something dumb, but I can't figure it out.
Hi Alex, I'm not sure what you mean exactly. It does indeed show a single page for a post, like here: https://dldx.github.io/hpstr-hugo-theme/posts/background-image.
Is that not what you wanted? Check that you have the right files in your content folder. You can just copy and paste all the files from the exampleSite folder into your main hugo folder, which should create everything you need to get started.
That is exactly the behavior I wanted yes, but when I copy the example site I get 404 not found when trying to get the same result. Everything else seems to work. I tried adding a new post (hugo new posts/test.md) and it worked. I noticed a bit of a difference in the files. The meta data of the new past looks like:
+++
Categories = ["Development","GoLang"]
Description = ""
Tags = ["Development","golang"]
date = "2017-04-26T07:17:09+02:00"
menu = "main"
title = "test"
+++
and the meta data in the files from the theme:
---
layout: post
title: Syntax Highlighting Post
description: "Demo post displaying the various ways of highlighting code in Markdown."
date: 2013-08-16
lastmod: 2016-09-05
tags: [sample post, code, highlighting]
image:
feature: /images/abstract-10.jpg
credit: dargadgetz
creditlink: http://www.dargadgetz.com/ios-7-abstract-wallpaper-pack-for-iphone-5-and-ipod-touch-retina/
---
Not sure if the small differences matter (Very new to HUGO), but I got my page working now at least.
You're missing the layout: post
part, which is very important to signify which section you want the post to be in. There are some additional features in this theme that Hugo didn't do so they were added as metadata. Sorry, I should make this clearer in the docs..
Hey, sorry for the late response. That did indeed solve the issue, thanks!
Edit: The following fixes the 404 issue on my end:
- Remove
layout: post
from metadata - Render site
- Add
layout: post
again - Render site
I have the same issue and I really don't get what's wrong...
This is what I've done:
hugo new site test
cd test/themes/
git clone https://github.com/dldx/hpstr-hugo-theme hpstr
cd ..
cp -rf themes/hpstr/exampleSite/* .
vim config.toml # Added base url
hugo server -D
Started building sites ...
WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.
Built site for language en:
0 draft content
0 future content
0 expired content
10 regular pages created
26 other pages created
0 non-page files copied
14 paginator pages created
9 tags created
0 categories created
total in 21 ms
Watching for changes in /home/username/test/{data,content,layouts,static,themes}
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
All posts are visible on the front page. Clicking on any of them (e.g. http://localhost:1313/posts/background-image/) gives me a 404. The post show up if I remove the layout: post
from the metadata.
Sounds like a weird glitch. Let me know if you still have problems!