You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
It appears that the CLI is appending an .html suffix to all target paths when generating the index, which doesn't match the structure of my static site. This results in 404 errors when navigating through the Pagefind UI, as it tries to access paths with .html appended.
Steps to Reproduce:
Create a static folder with paths that don't include .html suffixes:
static/
├── index
├── about
└── blog/
├── first-post
└── second-post
Run the pagefind CLI to generate the index (using a glob that doesn't require .html suffix: npx pagefind --site static --glob '**/*'
Use the Pagefind UI to navigate to any of the indexed paths.
Expected Behavior:
Target paths in the generated index should match the structure of the static folder without additional .html suffixes, and the Pagefind UI should navigate correctly.
I looked for a CLI option to change this behavior but couldn't find one.
Actual Behavior:
All target paths in the generated index have an .html suffix appended.
The Pagefind UI then attempts to navigate to these .html paths, leading to 404 errors, as these pages don’t exist.
GIF illustrating the behavior:
Interestingly, this means the pagefind CLI wouldn't work with Pagefind's own website: pagefind.app:
The text was updated successfully, but these errors were encountered:
One workaround I found is to rewrite the URLs in processResult (generated with Claude and tested to work in my case):
newPagefindUI({element: '#search',processResult: function(result){// Helper function to strip .html suffixconststripHtmlSuffix=(url)=>{returnurl.replace(/\.html($|#)/,'$1');};// Process the main URLresult.url=stripHtmlSuffix(result.url);// Process URLs in sub-resultsif(result.sub_results){result.sub_results.forEach((subResult)=>{subResult.url=stripHtmlSuffix(subResult.url);});}// If raw_url is present, process it tooif(result.raw_url){result.raw_url=stripHtmlSuffix(result.raw_url);}returnresult;},});
Description:
It appears that the CLI is appending an
.html
suffix to all target paths when generating the index, which doesn't match the structure of my static site. This results in 404 errors when navigating through the Pagefind UI, as it tries to access paths with.html
appended.Steps to Reproduce:
.html
suffixes:pagefind
CLI to generate the index (using a glob that doesn't require.html
suffix:npx pagefind --site static --glob '**/*'
Expected Behavior:
Target paths in the generated index should match the structure of the static folder without additional
.html
suffixes, and the Pagefind UI should navigate correctly.I looked for a CLI option to change this behavior but couldn't find one.
Actual Behavior:
.html
suffix appended..html
paths, leading to 404 errors, as these pages don’t exist.GIF illustrating the behavior:
Interestingly, this means the pagefind CLI wouldn't work with Pagefind's own website:
pagefind.app
:The text was updated successfully, but these errors were encountered: