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

Fix relURL for custom_css #252

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

nickjwhite
Copy link
Contributor

The way relURL was used meant that one needed to preface the custom_css
entries with a slash, or the href would be incorrectly set to
subdircss/mycss.css rather than subdir/css/mycss.css, in the case of
a baseURL in a subdir.

The way relURL was used meant that one needed to preface the custom_css
entries with a slash, or the href would be incorrectly set to
subdircss/mycss.css rather than subdir/css/mycss.css, in the case of
a baseURL in a subdir.
@regisphilibert regisphilibert self-requested a review February 5, 2020 20:37
@@ -20,7 +20,7 @@
{{ end }}

{{ range .Site.Params.custom_css }}
<link rel="stylesheet" href="{{ relURL ($.Site.BaseURL) }}{{ . }}">
<link rel="stylesheet" href="{{ relURL (.) }}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nickjwhite thank you for this.

Would you mind removing the () while you're at it. I understand they were there initially, but it turns out they're not needed.

<link rel="stylesheet" href="{{ relURL . }}">

This reads a bit picky, but we're getting back at improving the theme and use it to promote Hugo's best practices.

@@ -20,7 +20,7 @@
{{ end }}

{{ range .Site.Params.custom_css }}
<link rel="stylesheet" href="{{ relURL ($.Site.BaseURL) }}{{ . }}">
<link rel="stylesheet" href="{{ relURL (.) }}">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For your convenience:

Suggested change
<link rel="stylesheet" href="{{ relURL (.) }}">
<link rel="stylesheet" href="{{ relURL . }}">

I hope that makes it easier to fix!

@regisphilibert
Copy link
Member

@jan-xyz sorry for merging this so late! Thanks!

@regisphilibert regisphilibert merged commit cfbd40c into theNewDynamic:master Jun 3, 2020
Remicck pushed a commit to Remicck/gohugo-theme-ananke that referenced this pull request Mar 7, 2022
The way relURL was used meant that one needed to preface the custom_css
entries with a slash, or the href would be incorrectly set to
subdircss/mycss.css rather than subdir/css/mycss.css, in the case of
a baseURL in a subdir.

Co-authored-by: Nick White <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants