Comments (9)
As a temporary workaround, I inserted the following into gallery.html
{{ $siteURL := .Site.BaseURL }}
[snip]
{{- $linkURL := print $siteURL "/" ($.Get "dir") "/" .Name | absURL }}<!-- absolute URL to hi-res image -->
{{- $thumbURL := print $siteURL "/" ($.Get "dir") "/" $thumb | absURL }}<!-- absolute URL to thumbnail image -->
It works, although not sure if it isn't a little "hacky"...
from hugo-easy-gallery.
Thanks @tcwilkinson, this is an oversight on my part.
Probably more efficient to do something like
{{ $imgBaseURL := print .Site.BaseURL "/" ($.Get "dir") "/" }}
[snip]
{{- $linkURL := print $imgBaseURL .Name | absURL }}<!-- absolute URL to hi-res image -->
{{- $thumbURL := print $imgBaseURL "/" ($.Get "dir") "/" $thumb | absURL }}<!-- absolute URL to thumbnail image -->
I'm not in front of the correct computer for me to test this, so feel free to get something working and then submit a PR.
from hugo-easy-gallery.
@liwenyip Tried your patch for this problem as I have a documentation site that runs in a sub-folder of server root. it looks as if the patch works for the background URLs in "gallery from folder" mode, but does not fix "gallery from list" which suffers from the same problem.
Unfortunately I don't have time just now to triage this properly, but I'm sure you know your code well enough to spot why this is happening.
from hugo-easy-gallery.
Thanks @jbrice
I'm also kinda busy at the moment; so I'll add it to my to-do list. But I'd be very happy for someone else to fix and submit a PR in the meantime.
from hugo-easy-gallery.
Happy to put some time to it, and have had a go but "retired hurt" as I am a newcomer to Hugo/golang template coding and finding your code somewhat cryptic, probably as a result of that.
I have been unable to find much in-depth documentation or "power user" examples of Hugo template coding. Are there any resources you would recommend?
from hugo-easy-gallery.
@jbrice the Hugo documentation covers basics, and is improving all the time.
For more complicated questions, post/search in https://discourse.gohugo.io/
Good luck!
from hugo-easy-gallery.
Thank you!
Am making progress. However from a newcomers point of view a lot of the documentation looks great, but in practice feels as if it has been written by people who are much too familiar with the topic they are writing about. And https://discourse.gohugo.io/ is full of great nuggets but needs a lot of excavation to get to many of them.
from hugo-easy-gallery.
from hugo-easy-gallery.
@liwenyip
The mists are clearing and I think that the fix is fairly simple. I have found that the best (only?) way to use the current version of Hugo (V0.25.1) in a sub-folder of the server is to create the site with baseURL
set to the full path (domain plus path) to the site's root folder plus canonifyURLs = true
. Hugo then automatically prepends all asset URLs beginning with "/" with the baseURL
string, thus essentially doing the job of the additional code you suggested a short while ago (but on a site-wide basis).
However this URL completion is not foolproof and does not seem to process urls in CSS backgrounds in this way, including the one on line 13 of the current version of figure.html
. So I have proposed a simple change that I have found to work OK on a non-server-root test site, when used along with an appropriate baseURL
and canonifyURLs = true
set in the config.
from hugo-easy-gallery.
Related Issues (20)
- images have wrong dimensions HOT 2
- is there a lazy loading feature ? HOT 2
- There is no zoom-in animation when click a thumbnail HOT 1
- Slideshow/carousel instead of gallery HOT 1
- Installation Help HOT 3
- Migrate to an organisation? HOT 2
- Figure captions show above photo and push photo off screen on click
- Weird scrolling incompatibility with OverlayScrollbars HOT 1
- install problem, no layout folder
- Is there any way to set gallery dir to the post leaf bundle directory?
- How to scale thumb images?
- Margins
- image.jpg and image-thumb.jpg both showing as thumbnails HOT 1
- load-photoswipe shortcode does'nt works. HOT 1
- How to load external pictures?
- For anyone struggling to make a grid, here's my active fork HOT 4
- Help - Thumbnails show multiple times on top of each other? HOT 3
- Multiple Separate Galleries on One Page
- Gallery in hugo-relearn-theme is crooked
- An updated fork is available:
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugo-easy-gallery.