Repository navigation
Replies: 1 comment
|
Any ideas? |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi all!
Why does the gallery mode functionality disappear when I upload the site to GitHub, even though it works when I run it locally using
hugo server -D?Step 1: Create a new partial
First, create a new partial file for the modal window. In your Hugo project, navigate to the
layouts/partialsdirectory and create a new file namedgallery-modal.html. Add the following code to the file:Step 2: Modify the gallery shortcode
Next, you need to modify the
gallery.htmlshortcode file in thelayouts/shortcodesdirectory. Open the file and locate the{{ $relref := .Page.RelPermalink }}line. Below that line, add the following code:{{ $relref := .Page.RelPermalink }} {{ with .Get "album" }} {{ range (where .Site.Pages "Type" "in" (slice "jpg" "jpeg" "png" "gif")) }} <a href="#" onclick="openModal('{{ $relref }}{{ .RelPermalink }}')"> <img src="{{ $relref }}{{ .RelPermalink }}" alt="{{ .Name }}" /> </a> {{ end }} {{ end }}Step 3: Add CSS styles
Finally, add the necessary CSS styles to your theme. Open the
assets/scss/custom.scssfile and add the following code:when I click on an image in the gallery, the modal window open with the clicked image displayed.
All reactions