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

Incorrect site root path for packages in dev status? #2814

Open
jayhesselberth opened this issue Nov 9, 2024 · 0 comments
Open

Incorrect site root path for packages in dev status? #2814

jayhesselberth opened this issue Nov 9, 2024 · 0 comments

Comments

@jayhesselberth
Copy link
Collaborator

jayhesselberth commented Nov 9, 2024

In trying to fix #2804, I think I uncovered a different issue. It doesn't look like the site root path is set correctly for packages in dev status.

The paths to the head assets (favicon, JS, CSS) in the template are specified like this:

<link rel="icon" type="image/png" sizes="16x16" href="{{#site}}{{root}}{{/site}}favicon-16x16.png">

BUT in a site in dev status (i.e., pkgdown), site.root is an empty string. I think it should actually be /dev/ or dev/.

Here's the relevant bit of pkgdown::data_template() run on current pkgdown:

site:
  root: ''
  title: pkgdown

So what ends up happening on a dev site is that the site is copied to /dev, but the href values in the site head don't have the /dev/ prefix.

I am guessing this has gone unnoticed because most packages start with a release version, where everything (assets and site) is copied to /. Then, in a subsequent dev version, the site contents are copied to /dev, but the assets are still in /, so the head href links still work, but they're using the assets from the released site in /.

This is also why the favicon checker is failing in #2804. The head of the deployed site has:

<link rel="icon" type="”image/svg+xml”" href="favicon.svg">

but the file is actually in /dev/favicon.svg (correct link). And the deployed site only has the stuff in /dev and can't rely on anything in /.

You can also see this in the dev pkgdown site. It's head has the following, so is using the favicon assets from the released site:

<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">

I think the fix is to make site.root mirror pkg$development$prefix (but with a leading slash, so /dev/ instead of dev/)

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

1 participant