Feature: Search Option #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First of all, thank you very much for your work and time.
It would be interesting to have some kind of search, or alternatively, for the archives menu not to group them by month, or if it does, to show the title of each post. I have a blog built in Hugo with many articles (more than 400), and it would be very useful for visitors to have that option.
One option could be as shown in the screenshot.
Thank you very much.
You're right, search ends up being important. Maybe we could start with Pagefind. It's super easy to integrate. It indexes a local site build (e.g. /output). May need some options in the markup for what to include, etc., but that's quite simple, too.
https://pagefind.app/
FWIW, here's how I added it to my Hugo blog: https://baty.net/posts/2025/01/adding-pagefind-search-to-hugo/
This could be a good idea. I could keep the monthly archives, but have the archive page list all posts so they’re searchable. I’d avoid using an external JavaScript search engine (I built one for ITNBlog, which is currently powering my IT Notes blog), but having a single page with all posts might be easier and more in line with the project's idea.
Ok, I've implemented it. Now, there's a new configuration in the config.sh(.local):
Archive Page Configuration
ARCHIVES_LIST_ALL_POSTS="false" # Options: "true", "false". If true, list all posts on the main archive page.
If set to true, the Archives page will contain all the posts.
Could you please test it and tell me if it's ok? I've just committed and pushed it in the main repo.
Thank you!
OMG, thank you so much
It works great for me, thanks! One thing is that I needed to delete the cache, otherwise none of the individual posts were generated. Maybe that's expected.
Do you think the list of posts on the archive should be sorted reverse-chronologically instead? That would line up with my expectations, but I can live with it either way.
I can understand why you'd hesitate bolting on a javascript search, so this is a useful substitute.
Thanks again.
Can you check to make sure that the archives are rebuilt when needed? I just added a new post, ran "build" and the archives page did not include the new post. The new post is rendered properly on the home page.
The build output reads...
@jbaty wrote in #11 (comment):
Sure, I've reversed the order.
Caching hasn't been modified, yet, so it's expected. I'll work on it now.
@jbaty wrote in #11 (comment):
Ok, I've also fixed the caching. It should correctly detect a post has been added and rebuild the index page. Could you please test it now?
Archive generation now works for me. I cleared the cache, built, added a new post, built again and the new post was included on the Archive page. This is nice, thank you.
@jbaty wrote in #11 (comment):
Perfect! Closing the issue