When I look at the Ananke theme page at Ananke Gohugo Theme | Hugo Themes it says it supports Related Content. However, related content does not appear on my posts. When I look at Related content | Hugo it says to create a partial for this feature. I also don’t see any partials for related content in the theme’s directories. So do I just put it in my upper layouts directory without changing Ananke to get the related content?
I’m not using this theme, but I had a quick look, and this
Is listed in the side bar for posts.
Are you not seeing any Related
heading at all?
As to configuring the related content, see Related content | Hugo – but the default settings should give you … something I would think.
I think it’s odd that the file you showed me is called “menu-contextual”. Does that mean it’s in a menu? Maybe I’m looking in the wrong spot? For example: A Little More on the Hugo Transition | It's a Binary World 2.0 as of the time I’m writing this reply I don’t see related posts anywhere.
It’s an odd name, but it’s just a partial that’s included in the side bar. Names doesn’t matter much.
If sidebar is what I think it is…if you look at the page I linked, I don’t think I have a sidebar?
You do … but it doesn’t show up when you don’t have related content … The default config should in most common cases work OK, but … Try something ala (and look in the documentation for the options):
[related]
includeNewer = true
threshold = 50
toLower = true
[[related.indices]]
name = 'tags'
weight = 100
OK, I’ll give it a shot later today. If it works I’ll mark your answer as the solution.
Adding it in manually did not make it show up.
The default configuration for related content determines related content based on the following front matter fields:
- date
- keywords
- tags
If you want to determine related content solely by year+month, add this to your site configuration:
[related]
includeNewer = true
threshold = 80
[[related.indices]]
name = 'date'
pattern = '2006-01'
weight = 80
Regardless of which indices you configure, you may wish to include content that is newer than the current page. That’s why I have set includeNewer = true
under the related
key above.
There is a very important note in the documentation:
If you add a
related
configuration section, you need to add a complete configuration. It is not possible to just set, say,includeNewer
and use the rest from the Hugo defaults.
Hey, jmooring -
Either way it’s not creating them - whether I put it in manually or not. I wonder if it’s related to the fact that it also doesn’t seem to be building my tags or categories
The configuration above works great. Can you share your Git repository? That would save us both a lot of time.
Can’t post entire site to a repo because it is too big (static folder is 8.8GB) but here’s a gist of my config.toml:
Given that your configuration for “related” is identical to the default configuration, you can exclude this from your site configuration.
Yeah. That’s why I wanted access to your Git repository.
Are you sure you are checking the newest post for a sidebar of related pages?
Can you post the front matter of two articles that should be related?
jmooring -
Just like typical rubber ducking, you helped me figure it out on my own based on your questions. I used the wp2hugo script to convert my 19.5 year old WP site to Hugo. And EITHER Hugo has changed from when that script was written to now have categories and tags to be pluralized in the front matter OR the theme that the wp2hugo script used was configured for the front matter to use the singular version. Either way, once I edited the front matter to be plural it created the related posts AND the categories and tags.
So thank you for being patient with me and providing your questions so that I could figure this out.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.