You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, really nice work with Grav! I chose it on top of many other CMSs because:
is lean, fast and DB-less
has native multilanguage support troughout the system
has modular pages OOB
YAML-everything (wow!)
I am trying to build a template/gallery module starting from the Cookbook recipe but when I add, in imageX.meta.yaml the following:
title:
en: Title
it: Titolo
description:
en: Description
it: Descrizione
Twig engine crashes as, for what I understand from debug bar and Clockwork, multilanguage meta is stored inside an array and Twig/Grav expects a string.
Is there a workaround for supporting multi language metadata for images? It would be a great addition to the already excellent language support in Grav!
Thank you
The text was updated successfully, but these errors were encountered:
Further investigation lead to this conclusion, so I managed to manually recreate the <img> tag without errors: <img src="{{image.resize(640, 640).url}}"></img>
For multilanguage metadata I played around with bi-dimensional arrays this way (with checks and fallbacks):
{% if config.theme.imagemeta.enabled %}
{% for mf in config.theme.imagemeta.fields %}
{% if mf.enabled and (not image.meta[mf.meta_field] is null or not image.meta[mf.meta_field][lang] is null) %}
<p class="mg-metadata mg-meta-{{mf.meta_field}}">{% if not image.meta[mf.meta_field][lang] is null %}{{image.meta[mf.meta_field][lang]}}{% else %}{{image.meta[mf.meta_field]}}{% endif %}</p>
{% endif %}
{% endfor %}
{% endif %}
The next big step is to centralize Images in a folder and work/filter them as a database, even by tag in .meta file. I still have to dig deep into Grav's Flex Objects, it might be an option.
Hello, really nice work with Grav! I chose it on top of many other CMSs because:
is lean, fast and DB-less
has native multilanguage support troughout the system
has modular pages OOB
YAML-everything (wow!)
I am trying to build a template/gallery module starting from the Cookbook recipe but when I add, in imageX.meta.yaml the following:
Twig engine crashes as, for what I understand from debug bar and Clockwork, multilanguage meta is stored inside an array and Twig/Grav expects a string.
Is there a workaround for supporting multi language metadata for images? It would be a great addition to the already excellent language support in Grav!
Thank you
The text was updated successfully, but these errors were encountered: