Closed brankol closed 8 months ago
Hugo: {{ if .Site.IsServer }}
Twig {% if app.environment == 'dev' %}
Hugo:
{{ .Scratch.Set "source" "contact" }}
{{ .Scratch.Set "button_text" "Send" }}
{{ partial "contact-form.html" . }}
Twig:
{% include 'includes/contact_form.html.twig' with {
source: 'contact',
button_text: 'Send',
} only %}
Hugo:
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ $active := in $currentPage.RelPermalink .URL }}
<a
href="{{ .URL }}"
class="{{ if $active }} active{{ end }}"
>{{ .Name }} {{ .Post }}</a>
{{ end }}
Twig:
{% set current_route = app.request.attributes.get('_route') %}
{% for route in site.menu.main %}
{% set page = yassg_find_one_by('pages', {condition: {'item.slug': route}}) %}
<a
href="{{ path(route) }}"
class="{% if route == current_route %} active{% endif %}"
>{{ page.title }}</a>
{% endfor %}
Non-actionable.
Global config
Hugo:
{{ .Site.Title }}
Twig:{{ site.title }}
After adding
config/twig.yaml
: