Skip to content

Fix asset paths when baseURL has sub-folder#103

Merged
budparr merged 1 commit intotheNewDynamic:masterfrom
anthonyfok:fix-asset-paths-when-baseurl-has-subdir
May 17, 2018
Merged

Fix asset paths when baseURL has sub-folder#103
budparr merged 1 commit intotheNewDynamic:masterfrom
anthonyfok:fix-asset-paths-when-baseurl-has-subdir

Conversation

@anthonyfok
Copy link
Contributor

Hi @budparr,

https://themes.gohugo.io/theme/gohugo-theme-ananke/, a case where baseURL contains sub-folder, is not rendering correctly. It appears that absURL behaves differently when the path is prefixed with a / slash. The fix is to simply remove that leading slash.

The documentation at https://gohugo.io/functions/absurl/ does not seem to mention this fact explicitly. Maybe we should fix the hugoDocs too.

See also #97

Thanks!

@budparr
Copy link
Member

budparr commented May 2, 2018

Thank you, @anthonyfok I'll try to go through this tonight. I've been totally swamped this week.

@anthonyfok
Copy link
Contributor Author

You are very welcome @budparr! No hurries, nothing urgent, whenever you have time.

On second thought, relURL would work just as well absURL, and would make the generated HTML files slightly smaller, but that is entirely your preference, of course. :-)

@budparr
Copy link
Member

budparr commented May 2, 2018

I typically use relURL. Not sure why I would have done differently here.

@anthonyfok anthonyfok force-pushed the fix-asset-paths-when-baseurl-has-subdir branch from e98bcc5 to d013825 Compare May 2, 2018 17:58
@anthonyfok
Copy link
Contributor Author

I typically use relURL. Not sure why I would have done differently here.

It might be due to @anddongyangli's suggestion in #97 where he said: "We might want to set absolute URLs for these assets based on the configured baseURL".

I have changed the absURL to relURL and pushed a new commit to this pull request for your convenience. :-) No rush, whenever you have free time. Cheers!

@anthonyfok
Copy link
Contributor Author

@budparr Ping.

(Demo at https://themes.gohugo.io/theme/gohugo-theme-ananke/ still broken)

@anthonyfok
Copy link
Contributor Author

Actually, forget my "ping" for now, especially if you are busy.

Now I am suspecting that Hugo's absURL is buggy because its current behaviour differs from that in Hugo 0.14. In the current release, relURL is fine with a leading slash, but absURL is not, and that is inconsistent. Hmm... Need more investigation.

@budparr
Copy link
Member

budparr commented May 17, 2018

Thank you @anthonyfok I'm actually fine with the change, I just haven't had time to run it myself, which I try to do. But I'm going to merge this since that's broken. Thanks for keeping on me about this.

@budparr budparr merged commit 89c2617 into theNewDynamic:master May 17, 2018
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.

2 participants