Skip to content

When overriding page URL, subresults do not use the new URL (default UI) #1016

@angelikatyborska

Description

@angelikatyborska

Hi! I'm using pagefind with the default UI.

I wanted to use the feature to override the URL of a result exactly like described in the docs. It only worked for the main result, but all of the subresults still use their original URLs.

I believe this is the relevant code snippet: the result link uses data.meta?.url, but the subresult link does not.

<a class="pagefind-ui__result-link" href={data.meta?.url || data.url}
>{data.meta?.title}</a
>
</p>
{#if has_root_sub_result}
<p class="pagefind-ui__result-excerpt">{@html data.excerpt}</p>
{/if}
{#each non_root_sub_results as subres}
<div class="pagefind-ui__result-nested">
<p class="pagefind-ui__result-title">
<a class="pagefind-ui__result-link" href={subres.url}

The way I expected this feature to work is that I would be overwriting the URL for the whole page, including the sub results. For example, if I had the page with the URL /tutorial.html and I chose to overwrite it to https://my-app.com/docs/tutorial, I expected all the subresults to get overwritten from /tutorial.html#some-heading to https://my-app.com/docs/tutorial#some-heading etc.

Is this a bug, or are my expectations wrong? Is there a way to overwrite URLs of subresults too?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions