grav-theme-libretic/templates/modular_alt.html.twig

97 lines
3.3 KiB
Twig
Raw Normal View History

2015-01-26 11:57:05 +01:00
{% extends 'partials/base.html.twig' %}
{% set show_onpage_menu = header.onpage_menu == true or header.onpage_menu is null %}
{% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %}
{% block javascripts %}
{% if show_onpage_menu %}
{% do assets.add('theme://js/singlePageNav.min.js') %}
{% endif %}
{{ parent() }}
{% endblock %}
{% block bottom %}
{{ parent() }}
{% if show_onpage_menu %}
<script>
// singlePageNav initialization & configuration
$('#navbar').singlePageNav({
offset: $('#header').outerHeight(),
filter: ':not(.external)',
updateHash: true,
currentClass: 'active'
});
</script>
{% endif %}
{% endblock %}
{% block header_navigation %}
{% if show_onpage_menu %}
<ul class="navigation">
{% macro loop(page) %}
{% for p in page.children %}
{% if p.visible %}
{% set current_page = (p.active or p.activeChild) ? 'active' : '' %}
<li class="{{ current_page }}">
<a href="{{ p.url }}" class="external">
{% if p.header.icon %}<i class="fa fa-{{ p.header.icon }}"></i>{% endif %}
{{ p.menu }}
</a>
{% if p.children.count > 0 %}
<ul>
{{ _self.loop(p) }}
</ul>
{% endif %}
</li>
{% endif %}
{% endfor %}
{% endmacro %}
{% if theme_config.dropdown.enabled %}
2015-01-26 11:57:05 +01:00
{{ _self.loop(pages) }}
{% else %}
{% for page in pages.children %}
{% if page.visible %}
{% set current_page = (page.active or page.activeChild) ? 'active' : '' %}
<li class="{{ current_page }}">
<a href="{{ page.url }}" class="external">
{% if page.header.icon %}<i class="fa fa-{{ page.header.icon }}"></i>{% endif %}
{{ page.menu }}
2020-12-13 01:32:27 +01:00
2015-01-26 11:57:05 +01:00
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% for mitem in site.menu %}
<li>
<a href="{{ mitem.url }}">
{% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
{{ mitem.text }}
</a>
</li>
{% endfor %}
2020-12-13 01:32:27 +01:00
2015-01-26 11:57:05 +01:00
{% for module in page.collection() %}
{% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
<li class="{{ current_module }}"><a href="#{{ _self.pageLinkName(module.menu) }}">{{ module.menu }}</a></li>
{% endfor %}
</ul>
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block content %}
{% set blog_image = page.media.images|first %}
{% if blog_image %}
<div class="flush-top blog-header blog-header-image" style="background: {{ page.header.bg_color }} url({{ blog_image.url }}) no-repeat right;">
<h1>{{ page.title }}</h1>
</div>
{% endif %}
2020-12-13 01:32:27 +01:00
{{ page.content|raw }}
2015-01-26 11:57:05 +01:00
{% for module in page.collection() %}
<div id="{{ _self.pageLinkName(module.menu) }}"></div>
2020-12-13 01:32:27 +01:00
{{ module.content|raw }}
2015-01-26 11:57:05 +01:00
{% endfor %}
{% endblock %}