aboutsummaryrefslogtreecommitdiffstats
path: root/cl-theme/templates/article.html
blob: 9636ebcec19771405f9d48e82ae1b76b5f649260 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{% extends "base.html" %}

{% block html_lang %}{{ article.lang }}{% endblock %}
{% block head %}
    {% block title %}
        <title>{{ article.title }} - {{SITENAME}}</title>
    {% endblock %}
    {{ super() }}
    {% import 'translations.html' as translations with context %}
    {% if translations.entry_hreflang(article) %}
        {{ translations.entry_hreflang(article) }}
    {% endif %}

    {% if article.styles %}
        {% for style in article.styles %}
            {{ style|format(SITEURL) }}
        {% endfor %}
    {% endif %}
    {% if article.js %}
        {% for script in article.js %}
            {% if 'top' in script[-7:] %}
                {{ script[:-5]|format(SITEURL) }}
            {% endif %}
        {% endfor %}
    {% endif %}
    {% block seo %}
        {% set seo_description = article.summary|striptags %}
        {% set SEO_DESC_LENGTH = 175 %}
        {% if seo_description|length >= SEO_DESC_LENGTH %}
            {# Quita la última palabra para no dejarla incompleta #}
            {% set seo_description = seo_description[:SEO_DESC_LENGTH].split(' ')[:-1]|join(' ') %}
            {% if not seo_description[-1] in ['.', '?', ':', '!'] %}
                {% set seo_more = seo_description + '…' %}
                {% set seo_description = seo_more|replace('"','') %}
            {% endif %}
        {% endif %}
        <!-- Meta Article -->
        <meta name="author" content="{{ article.author.name }}"/>
        <meta name="description" content="{{ seo_description|striptags }}"/>
        <meta name="keywords" content="{{ article.tags|join(', ') }}"/>
        <meta property="article:author" content="{{ article.author }}"/>
        <meta property="article:section" content="{{ article.category }}"/>
        <meta property="article:published_time" content="{{ article.date.strftime("%Y-%m-%d-T%H-%M-%S") }}"/>
        {% if article.modified %}
            <meta property="article:modified_time" content="{{ article.modified.isoformat() }}"/>
        {% endif %}

        <!-- OpenGraph -->
        <meta property="og:type" content="article"/>
        <meta property="og:tag" content="{{ article.tags|join(',')|escape }}"/>
        <meta property="og:title" content="{{ article.title }} - {{ SITENAME }}"/>
        <meta property="og:description" content="{{ seo_description|striptags }}"/>
        <meta property="og:site_name" content="{{ SITENAME }}"/>
        <meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
        <meta property="og:image" content="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/../wp-content/uploads/article/poster/{{ article.image }}"/>

        <!-- Twitter -->
        <meta name="twitter:card" content="summary"/>
        <meta name="twitter:title" content="{{ article.title }} - {{ SITENAME }}"/>
        <meta name="twitter:description" content="{{ seo_description|striptags }}"/>
        <meta name="twitter:url" content="{{ SITEURL }}/{{ article.url }}"/>
        <meta name="twitter:image" content="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/../wp-content/uploads/article/poster/{{ article.image }}"/>
    {% endblock %}
{% endblock %}

{% block content %}
    <div class="container">
        <!-- start of posts -->
        <div class="columns is-multiline is-centered">
            <!-- start of post -->
            <article class="column is-10" itemscope itemtype="https://schema.org/CreativeWork">
                <div class="card">

                    <!-- post header -->
                    <div class="card-content-header">
                        <h2 class="title is-4 has-text-centered" id="titulo" itemprop="name">{{ article.title }}</h2>
                    </div>
                    <!-- end of post header -->

                    <!-- post content -->
                    <div class="card-content">
                        <div class="content">
                            <div class="card-inner-wrapper">
                                <!-- post text -->
                                <div class="card-content-text has-text-justified" itemprop="text">
                                    {% if article.toc %}
                                        <nav class="toc">
                                            {{ article.toc }}
                                        </nav>
                                    {% endif %}

                                    {{ article.content }}
                                </div>
                                <!-- end of post text -->

                                <!-- post footer -->
                                <div class="card-content-footer-small">
                                    <div class="navbar is-social-center">
                                        <a class="navbar-item" href="{{ SOCIAL['gnusocial'] }}">
                                            <span class="soumaicon">
                                                <svg>
                                                    <use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/icons/master.svg#gnusocial" />
                                                    <title>GNUSocial</title>
                                                </svg>
                                            </span>
                                        </a>
                                        <a class="navbar-item" href="{{ SOCIAL['diaspora'] }}">
                                            <span class="soumaicon">
                                                <svg>
                                                    <use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/icons/master.svg#diaspora" />
                                                    <title>Diaspora</title>
                                                </svg>
                                            </span>
                                        </a>
                                        <a class="navbar-item" href="{{ SOCIAL['mastodom'] }}">
                                            <span class="soumaicon">
                                                <svg>
                                                    <use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/icons/master.svg#mastodom" />
                                                    <title>Mastodom</title>
                                                </svg>
                                            </span>
                                        </a>
                                    </div>
                                    <!-- post footer nav -->
                                    {% include 'article_info.html' %}
                                    <!-- end of post footer nav -->
                                </div>
                                <!-- end of post footer -->
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end of post content -->

                <!-- post comments -->
                {% include 'comments.html' %}
                <!-- end of comments -->

            </article>
            <!-- end of post -->
        </div>
        <!-- end of post column -->
    </div>
{% endblock %}