Feature: Search Option #11

Closed
opened 2025-04-23 20:42:36 +02:00 by carlos · 10 comments

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.

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/

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/
Owner

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.

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.
stefano self-assigned this 2025-04-24 08:28:02 +02:00
Owner

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!

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!
Author

OMG, thank you so much

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.

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...

Main archive index page is up to date, skipping generation.
No affected archive months found. Skipping monthly/yearly page generation.
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... ``` Main archive index page is up to date, skipping generation. No affected archive months found. Skipping monthly/yearly page generation. ```
Owner

@jbaty wrote in #11 (comment):

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...

Main archive index page is up to date, skipping generation.
No affected archive months found. Skipping monthly/yearly page generation.

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 https://brew.bsd.cafe/stefano/BSSG/issues/11#issuecomment-208: > 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... > > ```text > Main archive index page is up to date, skipping generation. > No affected archive months found. Skipping monthly/yearly page generation. > ``` Sure, I've reversed the order. Caching hasn't been modified, yet, so it's expected. I'll work on it now.
Owner

@jbaty wrote in #11 (comment):

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...

Main archive index page is up to date, skipping generation.
No affected archive months found. Skipping monthly/yearly page generation.

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?

@jbaty wrote in https://brew.bsd.cafe/stefano/BSSG/issues/11#issuecomment-208: > 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... > > ```text > Main archive index page is up to date, skipping generation. > No affected archive months found. Skipping monthly/yearly page generation. > ``` 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.

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.
Owner

@jbaty wrote in #11 (comment):

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.

Perfect! Closing the issue

@jbaty wrote in https://brew.bsd.cafe/stefano/BSSG/issues/11#issuecomment-211: > 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. Perfect! Closing the issue
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: stefano/BSSG#11
No description provided.