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 resources so they honor .Site.BaseURL #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

farmergreg
Copy link

While trying out the theme from a relative location, I found problems.

For example if baseurl is set to "http://mysite/hugo/" then the image and css links
were wrong in the past because of the "hugo" sub directory.

Signed-off-by: Gregory L. Dietsche gregory.dietsche@cuw.edu

Signed-off-by: Gregory L. Dietsche <gregory.dietsche@cuw.edu>
@@ -21,7 +21,7 @@
{{ end }}
{{ end }}
{{ $srcset := delimit ($.Scratch.Get "srcset") "," }}
<a {{ printf "href=%q" ("/" | relLangURL) | safeHTMLAttr }}><img class="avatar" src="/{{ .Site.Params.avatar }}" {{ printf "srcset=%q" $srcset | safeHTMLAttr }}></a>
<a {{ printf "href=%q" ("/" | relLangURL) | safeHTMLAttr }}><img class="avatar" src="{{ .Site.BaseURL }}{{ .Site.Params.avatar }}" {{ printf "srcset=%q" $srcset | safeHTMLAttr }}></a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't .Site.BaseURL also be needed as the target of the avatar link (the round image at the top of the page), as well as when clicking on the name right below it? Perhaps Hugo already writes the links correctly, never placed a site in a subdirectory.

@shuichiro-makigaki
Copy link

waiting for merged 👍

@anapaulagomes
Copy link
Contributor

Do you have plans to merge it @nishanths ?

@@ -46,7 +46,7 @@
{{ if .Site.Params.faviconfile }}
href="/{{ .Site.Params.faviconfile }}"
{{ else }}
href="/img/favicon.ico"
href="{{ .Site.BaseURL }}img/favicon.ico"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if you noticed but there is an extra white space after BaseURL. 😅
Thanks for your PR, it helped me to solve a problem.

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.

4 participants