diff options
| author | Jieiku | 2023-08-17 12:16:18 -0700 |
|---|---|---|
| committer | Jieiku | 2023-08-17 12:16:18 -0700 |
| commit | 3e5d8a96e9eae21a799f327cd8a52adb891ebe66 (patch) | |
| tree | 6a1377b5207e4e3555f65ca162014468c64d6985 /templates/macros/macros.html | |
| parent | 1d9be812c25508a5dc36afb9e80669b668a47190 (diff) | |
| parent | 0983915e23793c28dd0bee149fd2ec05a7e96a94 (diff) | |
| download | abridge-3e5d8a96e9eae21a799f327cd8a52adb891ebe66.tar.gz abridge-3e5d8a96e9eae21a799f327cd8a52adb891ebe66.tar.bz2 abridge-3e5d8a96e9eae21a799f327cd8a52adb891ebe66.zip | |
resolve merge conflicts
Diffstat (limited to 'templates/macros/macros.html')
| -rw-r--r-- | templates/macros/macros.html | 160 |
1 files changed, 110 insertions, 50 deletions
diff --git a/templates/macros/macros.html b/templates/macros/macros.html index 2c17530..f994bdb 100644 --- a/templates/macros/macros.html +++ b/templates/macros/macros.html @@ -1,9 +1,9 @@ {%- macro title_post(page, config) %} - <h1><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a></h1> + <h1><a href="{{ page.permalink | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ page.title }}</a></h1> {%- endmacro title_post %} {%- macro meta_post(page, config) %} - <span{%- if config.extra.meta_post.size %} class="{{ config.extra.meta_post.size }}"{% endif %}> + <span{%- if config.extra.meta_post.size %} class="{{ config.extra.meta_post.size }}"{% endif %}> {#- Author #} {%- if page.taxonomies.authors and config.taxonomies %} @@ -24,7 +24,7 @@ {#- divider #} {%- if config.extra.meta_post.author %} - {%- if config.extra.meta_post.readtime or config.extra.meta_post.date or config.extra.meta_post.categories_tags %} + {%- if config.extra.meta_post.readtime or config.extra.meta_post.date or config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %} {%- endif %} {%- endif %} @@ -32,20 +32,42 @@ {#- ReadTime #} {%- if config.extra.meta_post.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_post.readstring | default(value="min") }} {#- divider #} - {%- if config.extra.meta_post.date or config.extra.meta_post.categories_tags %} + {%- if config.extra.meta_post.date or config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %} {#- Date #} - {%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} {{ page.date | date(format="%B %d, %Y") }} + {%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} + {%- if config.extra.date_locale %} + {%- if lang != config.default_language -%} + {%- set lang_locale = trans(key="date_locale" | safe, lang=lang) -%} + {%- else -%} + {%- set lang_locale = config.extra.date_locale -%} + {%- endif -%} + {{ page.date | date(format="%B %d, %Y", locale=lang_locale) }} + {%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %} + {#- divider #} + {%- if config.extra.meta_post.updated or config.extra.meta_post.categories_tags %} + {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} + + {#- Updated #} + {%- if config.extra.meta_post.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif -%} + {%- if lang != config.default_language %} {{ trans(key="Updated" | safe, lang=lang) }}{% else %} Updated{% endif %}: + {%- if config.extra.date_locale %} + {%- if lang != config.default_language -%} + {%- set lang_locale = trans(key="date_locale" | safe, lang=lang) -%} + {%- else -%} + {%- set lang_locale = config.extra.date_locale -%} + {%- endif %} {{ page.updated | date(format="%B %d, %Y", locale=lang_locale) }} + {%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %} {#- divider #} {%- if config.extra.meta_post.categories_tags %} {%- if config.extra.meta_post.divider %}<span class="hpad">{{ config.extra.meta_post.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} {#- Categories #} - {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} + {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} {#- Tags #} - {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> + {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> {%- endmacro meta_post %} {%- macro title_index(page, config) %} @@ -60,7 +82,7 @@ {%- if page.taxonomies.authors and config.taxonomies %} {%- for author in page.taxonomies.authors %} {%- if author_flag %}, {% endif %} - <a href="{{ get_taxonomy_url(kind='authors', name=author) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a> + <a href="{{ get_taxonomy_url(kind='authors', name=author, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ author }}</a> {%- set_global author_flag = true %} {%- endfor %} {%- elif page.extra.authors and config.extra.meta_index.author %} @@ -75,7 +97,7 @@ {#- divider #} {%- if config.extra.meta_index.author %} - {%- if config.extra.meta_index.readtime or config.extra.meta_index.date or config.extra.meta_index.categories_tags %} + {%- if config.extra.meta_index.readtime or config.extra.meta_index.date or config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %} {%- endif %} {%- endif %} @@ -83,31 +105,69 @@ {#- ReadTime #} {%- if config.extra.meta_index.readtime %} {%- if config.extra.icon_read %}<i class="{{ config.extra.icon_read }}"></i> {% endif %} {{ page.reading_time }} {{ config.extra.meta_index.readstring | default(value="min") }} {#- divider #} - {%- if config.extra.meta_index.date or config.extra.meta_index.categories_tags %} + {%- if config.extra.meta_index.date or config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{%- endif %} {#- Date #} - {%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} {{ page.date | date(format="%B %d, %Y") }} + {%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif %} + {%- if config.extra.date_locale %} + {%- if lang != config.default_language -%} + {%- set lang_locale = trans(key="date_locale" | safe, lang=lang) -%} + {%- else -%} + {%- set lang_locale = config.extra.date_locale -%} + {%- endif -%} + {{ page.date | date(format="%B %d, %Y", locale=lang_locale) }} + {%- else %} {{ page.date | date(format="%B %d, %Y") }} {%- endif %} + {#- divider #} + {%- if config.extra.meta_index.updated or config.extra.meta_index.categories_tags %} + {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} + + {#- Updated #} + {%- if config.extra.meta_index.updated and page.updated %} {%- if config.extra.icon_date %}<i class="{{ config.extra.icon_date }}"></i> {% endif -%} + {%- if lang != config.default_language %} {{ trans(key="Updated" | safe, lang=lang) }}{% else %} Updated{% endif %}: + {%- if config.extra.date_locale %} + {%- if lang != config.default_language -%} + {%- set lang_locale = trans(key="date_locale" | safe, lang=lang) -%} + {%- else -%} + {%- set lang_locale = config.extra.date_locale -%} + {%- endif %} {{ page.updated | date(format="%B %d, %Y", locale=lang_locale) }} + {%- else %} {{ page.updated | date(format="%B %d, %Y") }} {%- endif %} + {#- divider #} {%- if config.extra.meta_index.categories_tags %} {%- if config.extra.meta_index.divider %}<span class="hpad">{{ config.extra.meta_index.divider | safe }}</span>{%- else %} {%- endif %}{%- endif %}{% endif %} {#- Categories #} - {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} + {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}<i class="{{ config.extra.icon_info }}"></i> {% endif %} [{% for cat in page.taxonomies.categories %}<a href="{{ get_taxonomy_url(kind='categories', name=cat, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ cat }}</a>{% endfor %}]{% endif %} {#- Tags #} - {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> + {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #<a href="{{ get_taxonomy_url(kind='tags', name=tag, lang=lang) | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ tag }}</a> {% endfor -%}{%- endif %}</span> {%- endmacro meta_index %} -{%- macro footer(page) %} -{%- if page.reading_time %} -{%- if page.reading_time > 2 %} -<p><b><a href="#">Back to top</a></b></p> -{%- endif %} -{%- endif %} +{%- macro footer(page, config) %} + {%- if page.reading_time and page.reading_time > 2 %} + <p><b><a href="#">Back to top</a></b></p> + {%- endif %} + {#- prev/next content page nextprev title pagination #} + {%- if not config.extra.hide_page_nextprev_titles | default(value=false) %} + {%- if page.lower or page.higher %} + <nav> + <div> + {%- if page.lower %} + <a href="{{ page.lower.permalink | safe }}">‹ {{ page.lower.title | truncate(length=100) }}</a> + {%- endif %} + </div> + <div> + {%- if page.higher %} + <a href="{{ page.higher.permalink | safe }}"> {{ page.higher.title | truncate(length=100) }} ›</a> + {%- endif %} + </div> + </nav> + {%- endif %} + {%- endif %} {%- endmacro footer %} @@ -141,75 +201,75 @@ {%- endif %} {%- endif %} <nav> - <ul> + {%- set icon_first=config.extra.icon_first | default(value="svgs svgh angll") -%} + {%- set icon_prev=config.extra.icon_prev | default(value="svgs svgh angl") -%} + {%- set icon_next=config.extra.icon_next | default(value="svgs svgh angr") -%} + {%- set icon_last=config.extra.icon_last | default(value="svgs svgh angrr") -%} {%- if paginator.previous -%} - <li><a class="on outp" href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="First Page"> - {%- if config.extra.icon_first -%}<i class="{{ config.extra.icon_first }}" alt="First Page"></i> + <a class="on outp" href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="First Page"> + {%- if icon_first -%}<i class="{{ icon_first }}" alt="First Page"></i> {%- else -%}❰ {%- endif -%} - </a></li> + </a> {%- else -%} - <li><span class="off outp"> - {%- if config.extra.icon_first -%}<i class="{{ config.extra.icon_first }}" alt="First Page"></i> + <span class="off outp"> + {%- if icon_first -%}<i class="{{ icon_first }}" alt="First Page"></i> {%- else -%}❰ {%- endif -%} - </span></li> + </span> {%- endif -%} {%- if paginator.previous -%} - <li><a class="on outp" href="{{ paginator.previous | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Previous Page"> - {%- if config.extra.icon_prev -%}<i class="{{ config.extra.icon_prev }}" alt="Previous Page"></i> + <a class="on outp" href="{{ paginator.previous | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Previous Page"> + {%- if icon_prev -%}<i class="{{ icon_prev }}" alt="Previous Page"></i> {%- else -%}❬ {%- endif -%} - </a></li> + </a> {%- else -%} - <li><span class="off outp"> - {%- if config.extra.icon_prev -%}<i class="{{ config.extra.icon_prev }}" alt="Previous Page"></i> + <span class="off outp"> + {%- if icon_prev -%}<i class="{{ icon_prev }}" alt="Previous Page"></i> {%- else -%}❬ {%- endif -%} - </span></li> + </span> {%- endif -%} {%- for i in range(start=start, end=end+1) -%} - <li class="inp"> {%- if i == paginator.current_index -%} - <a class="on cnav" href="#">{{i}}</a> + <a class="inp on cnav" href="#">{{i}}</a> {%- elif i > 1 -%} - <a class="on" href="{{ paginator.base_url | safe }}{{ i ~ '/' }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{i}}</a> + <a class="inp on" href="{{ paginator.base_url | safe }}{{ i ~ '/' }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{i}}</a> {%- else -%} - <a class="on" href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ i }}</a> + <a class="inp on" href="{{ paginator.first | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}">{{ i }}</a> {%- endif -%} - </li> {%- endfor -%} {%- if paginator.next -%} - <li><a class="on outp" href="{{ paginator.next | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Next Page"> - {%- if config.extra.icon_next -%}<i class="{{ config.extra.icon_next }}" alt="Next Page"></i> + <a class="on outp" href="{{ paginator.next | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Next Page"> + {%- if icon_next -%}<i class="{{ icon_next }}" alt="Next Page"></i> {%- else -%}❭ {%- endif -%} - </a></li> + </a> {%- else -%} - <li><span class="off outp"> - {%- if config.extra.icon_next -%}<i class="{{ config.extra.icon_next }}" alt="Next Page"></i> + <span class="off outp"> + {%- if icon_next -%}<i class="{{ icon_next }}" alt="Next Page"></i> {%- else -%}❭ {%- endif -%} - </span></li> + </span> {%- endif -%} {%- if paginator.next -%} - <li><a class="on outp" href="{{ paginator.last | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Last Page"> - {%- if config.extra.icon_last -%}<i class="{{ config.extra.icon_last }}" alt="Last Page"></i> + <a class="on outp" href="{{ paginator.last | safe }}{%- if config.extra.uglyurls %}index.html{%- endif %}" title="Last Page"> + {%- if icon_last -%}<i class="{{ icon_last }}" alt="Last Page"></i> {%- else -%}❱ {%- endif -%} - </a></li> + </a> {%- else -%} - <li><span class="off outp"> - {%- if config.extra.icon_last -%}<i class="{{ config.extra.icon_last }}" alt="Last Page"></i> + <span class="off outp"> + {%- if icon_last -%}<i class="{{ icon_last }}" alt="Last Page"></i> {%- else -%}❱ {%- endif -%} - </span></li> + </span> {%- endif -%} - </ul> </nav> {%- endif %} {%- endmacro %} |
