-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
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.
@@ -20,7 +20,7 @@ | |||
{{ end }} | |||
|
|||
{{ range .Site.Params.custom_css }} | |||
<link rel="stylesheet" href="{{ relURL ($.Site.BaseURL) }}{{ . }}"> | |||
<link rel="stylesheet" href="{{ relURL (.) }}"> |
There was a problem hiding this comment.
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 (.) }}"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For your convenience:
<link rel="stylesheet" href="{{ relURL (.) }}"> | |
<link rel="stylesheet" href="{{ relURL . }}"> |
I hope that makes it easier to fix!
@jan-xyz sorry for merging this so late! Thanks! |
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]>
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.