From b299a35f3970c94f7fb5987801fa72c374937584 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Fri, 10 Jun 2022 22:25:01 -0700 Subject: Meta Data Options --- templates/base.html | 4 +- templates/index.html | 22 +++++------ templates/macros/macros.html | 87 +++++++++++++++++++++++++++++++++++++++----- templates/page.html | 5 +++ 4 files changed, 96 insertions(+), 22 deletions(-) (limited to 'templates') diff --git a/templates/base.html b/templates/base.html index 161e147..962cb88 100644 --- a/templates/base.html +++ b/templates/base.html @@ -48,7 +48,7 @@
  • {{ i.name | safe }}

  • {%- endfor %} {%- if config.extra.js_theme %} -
  • +
  • {%- if config.extra.fontawesome %}{%- else %}{%- endif %} {%- endif %}
  • @@ -112,5 +112,7 @@ {%- endblock footer %} +{%- block gotop %} +{%- endblock gotop %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 03a652c..6d3bfe0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -22,11 +22,17 @@ {{- macros_head::seo(title=title, title_addition=title_addition, description=description, is_home=true) }} {%- endblock seo %} + + {%- block content %}
    {%- for page in paginator.pages %}

    {{ page.title }}

    + {%- if config.extra.meta_index.position %} + {%- if config.extra.meta_index.position == "top" or config.extra.meta_index.position == "both" %} + {{- macros::title_index(page=page) }} + {%- endif %}{%- endif %}

    {%- if page.summary %} {{ page.summary | markdown(inline=true) | safe }} @@ -38,17 +44,11 @@ {%- endif %} ...more

    - - {%- if page.taxonomies.authors and config.taxonomies %} - {%- for author in page.taxonomies.authors %} - {%- if author_flag %} and {% endif %} - {{ author }} - {%- set_global author_flag = true %} - {%- endfor %} - {%- elif config.extra.author and config.extra.author_show %}{{ config.extra.author }} - {%- endif %} {{ page.date | date(format="%Y %B %d") }}{%- if config.extra.readtime %} {{ page.reading_time }} {{ config.extra.readtime_string | default(value="min") }} {% endif %} -{%- if page.taxonomies.categories %} [{% for cat in page.taxonomies.categories %}{{ cat }}{% endfor %}]{% endif %} -{%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %} + {%- if config.extra.meta_index.position %} + {%- if config.extra.meta_index.position == "bottom" or config.extra.meta_index.position == "both" %} + {{- macros::title_index(page=page) }} + {%- endif %} + {%- endif %}
    {%- endfor %} {{- macros::pagination(paginator=paginator) }} diff --git a/templates/macros/macros.html b/templates/macros/macros.html index 4b6c7d5..e818bfd 100644 --- a/templates/macros/macros.html +++ b/templates/macros/macros.html @@ -1,20 +1,87 @@ {%- macro title(page) %} -

    {{ page.title }}

    - - {%- if page.taxonomies.authors and config.taxonomies %} - {%- for author in page.taxonomies.authors %} + + + {#- Author #} + {%- if page.taxonomies.authors and config.taxonomies %} + {%- for author in page.taxonomies.authors %} + {%- if author_flag %} and {% endif %} + {{ author }} + {%- set_global author_flag = true %} + {%- endfor %} + {%- elif config.extra.author and config.extra.meta_post.author %} + {%- if config.extra.icon_author %}{%- endif %}{{ config.extra.author }} + {%- endif %} + + {#- 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.divider %}{{ config.extra.meta_post.divider | safe }}{%- else %} {%- endif %} + {%- endif %} + {%- endif %} + + {#- ReadTime #} + {%- if config.extra.meta_post.readtime %} {%- if config.extra.icon_read %}{%- 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.divider %}{{ config.extra.meta_post.divider | safe }}{%- else %} {%- endif %}{%- endif %}{%- endif %} + + {#- Date #} + {%- if config.extra.meta_post.date %} {%- if config.extra.icon_date %}{%- endif %}{{ page.date | date(format="%B %d, %Y") }} + {#- divider #} + {%- if config.extra.meta_post.categories_tags %} + {%- if config.extra.meta_post.divider %}{{ config.extra.meta_post.divider | safe }}{%- else %} {%- endif %}{%- endif %}{% endif %} + + {#- Categories #} + {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}{%- endif %}[{% for cat in page.taxonomies.categories %}{{ cat }}{% endfor %}]{% endif %} + + {#- Tags #} + {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %} +{%- endmacro title %} + + +{%- macro title_index(page) %} + + + {#- Author #} + {%- if page.taxonomies.authors and config.taxonomies %} + {%- for author in page.taxonomies.authors %} {%- if author_flag %} and {% endif %} {{ author }} {%- set_global author_flag = true %} - {%- endfor %} - {%- elif config.extra.author and config.extra.author_show %}{{ config.extra.author }} - {%- endif %} {{ page.date | date(format="%B %d, %Y") }} -{%- if page.taxonomies.categories %} [{% for cat in page.taxonomies.categories %}{{ cat }}{% endfor %}]{% endif %} -{%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %} -{%- if config.extra.readtime %} {{ page.reading_time }} {{ config.extra.readtime_string | default(value="min") }} {% endif %} + {%- endfor %} + {%- elif config.extra.author and config.extra.meta_index.author %} + {%- if config.extra.icon_author %}{%- endif %}{{ config.extra.author }} + {%- endif %} + + {#- 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.divider %}{{ config.extra.meta_index.divider | safe }}{%- else %} {%- endif %} + {%- endif %} + {%- endif %} + + {#- ReadTime #} + {%- if config.extra.meta_index.readtime %} {%- if config.extra.icon_read %}{%- 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.divider %}{{ config.extra.meta_index.divider | safe }}{%- else %} {%- endif %}{%- endif %}{%- endif %} + + {#- Date #} + {%- if config.extra.meta_index.date %} {%- if config.extra.icon_date %}{%- endif %}{{ page.date | date(format="%B %d, %Y") }} + {#- divider #} + {%- if config.extra.meta_index.categories_tags %} + {%- if config.extra.meta_index.divider %}{{ config.extra.meta_index.divider | safe }}{%- else %} {%- endif %}{%- endif %}{% endif %} + + {#- Categories #} + {%- if page.taxonomies.categories %} {%- if config.extra.icon_info %}{%- endif %}[{% for cat in page.taxonomies.categories %}{{ cat }}{% endfor %}]{% endif %} + + {#- Tags #} + {%- if page.taxonomies.tags %} {%- for tag in page.taxonomies.tags %} #{{ tag }} {% endfor -%}{%- endif %} {%- endmacro title %} + + {%- macro footer(page) %}

    Back to top

    {%- endmacro footer %} diff --git a/templates/page.html b/templates/page.html index 736a11e..c653018 100644 --- a/templates/page.html +++ b/templates/page.html @@ -32,6 +32,7 @@ {%- block content %}
    +

    {{ page.title }}

    {{- macros::title(page=page) }} {{ page.content | safe }} {%- block page_footer %} @@ -63,3 +64,7 @@ {%- endif %} {%- endblock toc %} {%- endblock content %} + +{%- block gotop %} +⋏ +{%- endblock gotop %} \ No newline at end of file -- cgit v1.3.1