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

bigimg example not working on themes.gohugo.io #196

Open
fedelibre opened this issue Sep 24, 2018 · 4 comments
Open

bigimg example not working on themes.gohugo.io #196

fedelibre opened this issue Sep 24, 2018 · 4 comments
Labels

Comments

@fedelibre
Copy link

fedelibre commented Sep 24, 2018

The bigimg example in the example site is not working because the website static dir is not in the web server root.

Perhaps the problem is here?

@grantcooksey
Copy link

I ran into this issue too for a project using github pages. I'm still digging around for the root cause but I don't think its a naming issue in the style tag. It looks like the urls paths are not generating correctly off the baseURL.

{{ if $bigimg }}
<div id="header-big-imgs" data-num-img={{len $bigimg}} {{range $i, $img := $bigimg}}data-img-src-{{add $i 1}}="{{$img.src | absURL }}" {{ if $img.desc}}data-img-desc-{{add $i 1}}="{{$img.desc}}"{{end}}{{end}}></div>
{{ end }}

The domain name for a github-pages site is https://github.<username>.io/<project_name> and this is set in my config.toml file correctly.

{{$img.src | absURL }} generates the url for the image so if my image path is /img/hello.jpg, the final url should come out as https://github.<username>.io/<project_name>/img/hello.jpg rather than incorrectly as https://github.<username>.io/img/hello.jpg. Not sure why the <project_name> path got chopped off. The example site mirrors this problem.

What's confusing is that this isn't happening for all static resources that are passed into baseURL, ie the profile image and the javascript script resources. I'll continue investigating...

@julian-alarcon
Copy link

I think that this is related to this bug on Gitlab demo page:
https://gitlab.com/pages/hugo/issues/20

Also, someone made a fix to a similar issue with the css:
https://discourse.gohugo.io/t/baseurl-for-deployment-messing-up-links-to-static/9214/16

@julian-alarcon
Copy link

Ok, I just found that this is a duplicated bug, the bug with the issue and the fix is this: #26

sed -i -r 's/\"\{\{\$img\.src \| absURL \}\}\"/"{{$.Site.BaseURL}}{{$img.src}}"/g' ./themes/beautifulhugo/layouts/partials/header.html

It replaces "{{$img.src | absURL }}" with "{{$.Site.BaseURL}}{{$img.src}}".

@halogenica halogenica added the bug label Nov 14, 2018
@julian-alarcon
Copy link

Soo.. removing the blog post of example of the bigimage feature was simplier. Hahaha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants