Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to override URLs? #686

Open
geoffroy-noel-ddh opened this issue Aug 22, 2024 · 1 comment
Open

How to override URLs? #686

geoffroy-noel-ddh opened this issue Aug 22, 2024 · 1 comment

Comments

@geoffroy-noel-ddh
Copy link

geoffroy-noel-ddh commented Aug 22, 2024

I've followed the instructions on how to override page urls but the search results appear unaffected.

Steps to reproduce

Create index.html under a new folder called site:

<!DOCTYPE html>
<html lang="en">
<head>
        <meta charset="utf-8">
        <title>Page title</title>
        <link data-pagefind-meta="url[href]" rel="canonical" href="https://example.com/other-url">
</head>
<body>
 <h1>title 1</h1>
 <p>A simple sentence to be indexed.</p>
</body>
</html>

Add a search page under site/search.html:

<html>
<body>
<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/pagefind/pagefind-ui.js"></script>
<div id="search"></div>
<script>
    window.addEventListener('DOMContentLoaded', (event) => {
        new PagefindUI({ element: "#search", showSubResults: true });
    });
</script>
</body>
</html>

Index and serve with pagefind 1.1.0:

npx pagefind --site site --serve

Point your browser to localhost:1414/search.html.

Search for 'sent'

The correct result appears:

image

However that hyperlink points to http://localhost:1414/ .

Instead, according to the documentation, I was expecting the URL to be https://example.com/other-url .

Did I misunderstand or forget something or made a mistake? Or is that a bug?

Thanks in advance for the assistance.

@bglw
Copy link
Contributor

bglw commented Aug 27, 2024

Hey @geoffroy-noel-ddh 👋

Thanks for the great report and reproduction. Yes this is indeed a bug! I'll get it fixed up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants