Comments (3)
HEG doesn't normally need you to use a shortcode in a template file.
What are you trying to do?
In general, if you want to call a shortcode from a template, copy and paste the contents of the shortcode into your template.
from hugo-easy-gallery.
I had the same question. I want to call the gallery shortcode from a single.html layout file. The directory argument should come from the front matter. Something like this:
{{< gallery dir="/images/{{ .Params.dir }}" />}}
But like beatrice said, shortcodes do not work in template files. Any ideas?
from hugo-easy-gallery.
You'll need to copy gallery.html
into your template file, or into partial template which you call from your main template.
You'll have to hard-code all the variables normally passed to the shortcode (i.e. every instance of .Get
).
e.g. Change
<div class="gallery caption-position-{{ with .Get "caption-position" | default "bottom" }}{{.}}{{end}} caption-effect-{{ with .Get "caption-effect" | default "slide" }}{{.}}{{end}} hover-effect-{{ with .Get "hover-effect" | default "zoom" }}{{.}}{{end}} {{ if ne (.Get "hover-transition") "none" }}hover-transition{{end}}" itemscope itemtype="http://schema.org/ImageGallery">
to
<div class="gallery caption-position-bottom caption-effect-slide hover-effect-zoom hover-transition" itemscope itemtype="http://schema.org/ImageGallery">
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.