{###################################### menu widget Provide the widget with a content page that contains your menu: {{ widgets::menu(content="_common/menus/main.md") }} Separate entries with a thematic break: either ---, ~~~, ___ or
You cannot use

tags in the menu. That's because we can't access raw markdown ######################################} {% macro menu(path) %}

{% endmacro menu %} {% macro columns(path) %}
{%- set source = self::i18n_content(path=path) -%} {% set entries = source | split(pat="
") %} {#- fetch page content and divide it with separator -#} {%- for entry in entries %}
{{ entry | trim | replace(from="

", to="") | replace(from="

", to="") | safe }} {# strip paragraph tags away for nicer markup #}
{%- endfor %}
{% endmacro columns %} {%- macro i18n_path(path) -%} {% if lang == config.default_language %}{{ path }} {%- else -%} {%- set parts = path | split(pat=".md") -%} {%- for part in parts -%} {%- if part and not loop.first -%}.md{%- endif -%} {%- if not loop.last -%}{{ part }}{%- endif -%} {%- endfor -%} .{{ lang }}.md {%- endif -%} {%- endmacro i18n_path -%} {%- macro i18n_content(path) -%} {{ get_page(path=self::i18n_path(path=path)) | get(key="content") }} {%- endmacro i18n_content -%} {%- macro i18n_url(path) -%} {%- if lang == config.default_language -%}{{ get_url(path=path) }} {%- else -%} {%- set p = lang ~ "/" ~ path -%}{{ get_url(path=p) }}{%- endif -%} {%- endmacro i18n_url -%} {% macro translations(translations) %} ({{ lang }}){% for t in translations %}{% if lang != t.lang %} {{ t.lang }}{% endif %}{% endfor %} {% endmacro translations %} {%- macro strip_lang_from_path(path, lang) -%} {%- set lang_path = lang ~ '/' -%} {%- if path is starting_with(lang_path) -%} {%- if path == lang_path -%} {%- set found_lang = true -%} {%- set path = "" -%} {%- else -%} {%- set path = path | replace(from=lang_path, to='') %} {%- endif -%} {%- endif -%} {% if path != '/' %}{{ path }}{% endif %} {%- endmacro strip_lang_from_path -%} {# Need to use separate names for variables, otherwise the paginator collides with that of index.html. Also, full_articles and section_title are useful to home section #} {% macro section(cur_section=false, cur_paginator=false, full_articles=true, title=true, cur_pages, render_list=true) %}
{% if cur_section %}{# Section presentation #} {% if title %}

{{ cur_section.title }}{% if cur_paginator and cur_paginator.number_pagers > 1 %} ({{ cur_paginator.current_index }}/{{ cur_paginator.number_pagers }}){% endif %}

{% endif %} {# Even if called from a different section (such as homepage), we want the semantic permalink to the collection to match the content #} {% endif %}{# End of section presentation #} {% set pages = cur_paginator.pages| default(value=cur_pages) %} {% if pages|length < 1 and render_list %}

{{ self::t(key="nothing_yet") }}

{% endif %} {% if cur_section.content %} {% endif %} {% for page in pages %}

{{ page.title }}

{%- if page.date -%}{%- endif -%}
{% if page.summary %}
{{ page.summary | markdown | safe }} --> {{ self::t(key="readmore") }} <--
{% elif full_articles %}
{{ page.content | markdown | safe }}
{% endif %}
{% endfor %} {% if cur_paginator and cur_paginator.number_pagers > 1 %} {% endif %}
{% endmacro section %} {# Translate a string in the current language (lang) by looking up a key in the config.extra.translations.lang. These translation strings extend (and potentially replace) those of the theme. #} {%- macro t(key) -%} {%- if config.extra.missing_translations|default(value="error") == "error" -%}{{ config.extra.translations[lang][key] }} {%- elif config.extra.missing_translations == "placeholder" -%}{{ config.extra.translations[lang][key]|default(value=key) }} {%- else -%}{{ config.extra.translations[lang][key]|default(value=config.extra.translations[config.extra.missing_translations][key]) }}{%- endif -%} {%- endmacro t -%}