aboutsummaryrefslogtreecommitdiff
path: root/templates/page.html
blob: 36ff4f4cd36fc7506d6ba521e0347117b202fbd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{# This Page Shows the Individual Blog Posts#}

{% extends "base.html" %}

{%- block seo %}
  {{- super() }}
  {%- set title_addition = "" %}
  {%- if page.title and config.title %}
    {%- set title = page.title %}
    {%- set title_addition = title_separator ~ config.title %}
  {%- elif page.title %}
    {%- set title = page.title %}
  {%- else %}
    {%- set title = config.title %}
  {%- endif %}

  {%- if page.description %}
    {%- set description = page.description %}
  {%- else %}
    {%- set description = config.description %}
  {%- endif %}
  {%- set created_time = page.date %}
  {%- set updated_time = page.updated %}
  {%- if current_section %}
    {%- set page_section = current_section %}
  {%- else %}
    {%- set page_section = "" %}
  {%- endif %}

  {{- macros_head::seo(config=config, title=title, title_addition=title_addition, description=description, type="article", is_page=true, created_time=created_time, updated_time=updated_time, page_section=page_section) }}
{%- endblock seo %}

{%- block comments_init %}
  {%- if config.extra.comments.hyvor %}
  <script defer src="https://talk.hyvor.com/embed/embed.js" type="module"></script>
  {%- endif %}
{%- endblock comments_init %}

{%- block content %}
    <article>
    {{- macros::title_post(page=page, config=config) }}

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

{{ page.content | safe }}

    {%- if config.extra.meta_post.position %}
    {%- if config.extra.meta_post.position == "bottom" or config.extra.meta_post.position == "both" %}
    {{- macros::meta_post(page=page, config=config) }}
    {%- endif %}{%- endif %}

    {%- block page_footer %}
    {{- macros::footer(page=page, config=config) }}
    {%- endblock page_footer %}

    {%- block comments_body %}
    {%- if config.extra.comments.hyvor %}
    <hyvor-talk-comments website-id={{ config.extra.comments.hyvor }} page-id={{ page.slug }}{%- if config.extra.comments.hyvorcolor %} colors="{{ config.extra.comments.hyvorcolor }}"{%- endif %}></hyvor-talk-comments>
    {%- endif %}
    {%- endblock comments_body %}
    </article>
    {%- block toc %}
    {%- if page.extra.toc and config.extra.recent %}
    {%- set toc = page.toc %}
    {%- endif %}
    {%- if toc %}
    <div class="toc">
      <div class="toc-sticky">
        <h3>{%- if lang != config.default_language %}{{ trans(key="Index" | safe, lang=lang) }}{% else %}Index{% endif %}</h3>
        {%- for h in toc %}
        <div class="toc-item">
          <a class="subtext" href="#{{h.id | safe}}">{{ h.title }}</a>
        </div>
        {%- if h.children %}
        {%- for h2 in h.children %}
        <div class="toc-item-child">
          <a class="subtext" href="#{{h2.id | safe}}"><small>- {{ h2.title }}</small></a>
        </div>
        {%- endfor %}
        {%- endif %}
        {%- endfor %}
      </div>
    </div>
    {%- endif %}
    {%- endblock toc %}

{%- endblock content %}

{%- block gotop %}

{%- if page.reading_time %}
{%- if page.reading_time > 2 %}
{%- set icon_top=config.extra.icon_top | default(value="svgs svgh angu") -%}
<span class="topout">
<span class="topleft"> </span><a href="#" class="top" title="Back to Top">{%- if icon_top %}<i class="{{ icon_top }}"></i>{%- else %}&cuwed;{%- endif %}</a>
</span>
{%- endif %}
{%- endif %}

{%- endblock gotop %}