Closed Suplanus closed 8 months ago
Sure, it's a little convoluted but very flexible :) It should possibly be documented.
In `_demo/pages/01.home/home.md, line 24 (which I don't seem to be able to link to directly), there is:
features:
items:
'@taxonomy.pagetype': 'feature'
order:
by: default
which is defining a Grav collection called 'features', made up of every page tagged 'feature' in the taxonomy vocabulary 'pagetype', so any page with taxonomy.pagetype: feature
in the frontmatter.
Let's take the page you can see in the screenshot, right-sidebar.md
. It has that in its frontmatter, and then these items as well in its frontmatter:
spotlight:
image: 'images/pic04.jpg' # spotlight.jpg
headline: 'Interdum felis blandit praesent sed augue'
subheading: 'Nunc commodo accumsan eget id nisi eu col volutpat magna'
blurb: 'Feugiat accumsan lorem eu ac lorem amet ac arcu phasellus tortor enim mi mi nisi praesent adipiscing. Integer mi sed nascetur cep aliquet augue varius tempus lobortis porttitor lorem et accumsan consequat adipiscing lorem.'
# button:
# text: 'Learn More'
This is where that info is pulled from. So the direct answer to your question is spotlight.image
in every page tagged pagetype='feature'. Change that for a different image.
You could redefine that collection 'features' in the homepage if you want, using a taxonomy query, a fixed list of pages, or any of the methods available for defining a Grav collection.
If you look at how this works in Twig, you can see home.html.twig
just loads the collection based on its name, then calls partials/sections/features.html.twig
on each feature item.
That template checks for image
in the frontmatter under spotlight
and has a fallback too.
A bit quick but I hope that explains it.
Great. Thanks a alot 😘 I will look into it!
Hi! Sorry but i dont understand your previous explanation. Could you write me exact code to put in home yaml section to run sidebar in home page? Becasue in demo pages home-sidebars is inactivated (and no code for this) and i spend few hours to figured out how to activated it with no result. Thanks in advance!
Great! I manage to solve the issue I had with this: thanks for the explanation, @hughbris
In your live demo there are this side elements:
But in the
_demo
I can not see how to do this. Is it possible to set the images? Also dont understand that forintro
.