hugo-toha / toha

A Hugo theme for personal portfolio
https://hugo-toha.github.io
MIT License
1.02k stars 583 forks source link

assets refs generated without proper baseURL #89

Closed abulka closed 3 years ago

abulka commented 4 years ago

When deploying to GitHub as a project site and thus setting baseURL to e.g.

baseURL: "https://abulka.github.io/hugo_quickstart/"

hugo generates some refs ok but not css and js references. For example index.html contains:

<link rel="stylesheet" href="/assets/css/bootstrap.min.css" />

which results in the request to https://abulka.github.io/assets/css/bootstrap.min.css which is missing the hugo_quickstart/ portion of the url.

Not sure if its a theme issue or Hugo issue, but e.g. https://github.com/gohugoio/hugo/issues/5226 seems to suggest theme authors might need to update their themes - something to do with .RelPermalink - or perhaps users need to do some workaround? Its a bit over my head.

The ananke theme generates urls correctly e.g.

<link href="/hugo_quickstart/dist/css/app.4fc0b62e4b82c997bb0041217cd6b979.css" rel="stylesheet">

Thoughts?

alex-bezek commented 3 years ago

hmm i think RelPermalink is used for permalinking to posts. I think instead we would update these links https://github.com/hossainemruz/toha/blob/master/layouts/partials/header.html#L6 https://gohugo.io/functions/relurl/

It seems thats what ananke is doing https://github.com/theNewDynamic/gohugo-theme-ananke/blob/f5cdf1f3a6ce58040dba752b684988e7251c2e37/layouts/_default/baseof.html#L20-L24 https://github.com/theNewDynamic/gohugo-theme-ananke/blob/89c26174a48f786f728c57d78fa53ffc100389c0/layouts/partials/site-scripts.html#L3

alex-bezek commented 3 years ago

@abulka this should be resolved in the recent PR https://github.com/hossainemruz/toha/pull/120 Can you consume that change and test please? Thanks!

hossainemruz commented 3 years ago

This should be fixed now. @abulka try pulling the master. Feel free to reopen if the issue persist.