I was wondering if it was possible to make parts of a page, certain fields, visible only to users that are logged in.
For instance, take a look at this linked page. I would like the fields under Statblock to be visible to me (or an Admin).
I just had a thought: I wonder if I could put those Statblock fields in a Partials template and somehow only include that partial if
an admin was logged in. I have no clue how to do that, if it’s possible, or if there is a better way.
Wonderful! That worked perfectly. I have to say, and I’m only a dabbler working on a personal project, but Grav is the most fun I’ve ever had making a web site.
Here’s my code:
{% if config.plugins.login.enabled and grav.user.username == "admin's user name" %}
<h2>Statblock</h2>
<div>
{{ header.character.statblock|markdown }}
</div>
{% endif %}
Awesome, so glad you got it working. Grav is brilliantly designed, and the use of Twig opens up customization possibilities for a lot more people (including myself, I am not a ‘dev’)