blog

Small changes to presentation

Author
Maarten Vangeneugden
Date
April 12, 2025, 6:03 p.m.
Hash
c00c1fbbb47abbf4821cf906f3ab4557b83febf3
Parent
3b5232d85ab878f04f711bbbfa304d1ef7a4d725
Modified files
templates/blog/index.djhtml
templates/blog/post.djhtml

templates/blog/index.djhtml

12 additions and 6 deletions.

View changes Hide changes
1
1
{% load i18n %}
2
2
{% load static %}
3
3
4
4
{% block stylesheets %}
5
5
    {{ block.super }}
6
6
    <style>
7
7
    img {
8
8
    width: 80%;
9
9
     display: block;
10
10
  margin-left: auto;
11
11
  margin-right: auto;
12
12
    }
13
13
    video {
14
14
    width: 80%;
15
15
    } 
16
16
    </style>
17
17
{% endblock %}
18
18
19
19
{% block title %}{% trans "Maarten's blog" %}{% endblock title %}
20
20
21
21
{% block description %}{% blocktrans %}The always coherently put together, yet
22
22
fuzzy blog of whatever sprouts in my mind.{% endblocktrans %}
23
23
{% endblock description %}
24
24
25
25
{% block header %}
26
26
<header>                                                                                                                                                                                         
27
27
    <label for="nav-drawer-toggle"></label>
28
28
    <h1>{% trans "Notepad of a student" %}</h1>  
29
29
</header>
30
30
{% endblock header %}
31
31
32
32
{% block nav %}
33
33
<input id="nav-drawer-toggle" type="checkbox" />
34
34
<nav>
35
35
    <label for="nav-drawer-toggle"><!--🡨-->🡠</label>
36
36
    <h2>{% trans "Navigation" %}</h2>
37
37
    <a class="nav-link" href="{% url 'about-index' %}">{% trans "Front page" %}</a>
38
38
    <hr>
39
39
    {% for post in posts %}
40
40
    {% if post.article %}
41
41
        <a class="nav-link" href="{% url 'blog-post' post.article.language_code post.article.slug %}">
42
42
            {{ post.title }}
43
43
        </a>
44
44
    {% else %}
45
45
        {% for article in post.articles %}
46
46
        <a class="nav-link" href="{% url 'blog-post' article.language_code article.slug %}">
47
47
            {% if article.language_code == "nl-be" %}
48
48
            ({% translate "Flemish" %})
49
49
            {% elif article.language_code == "fr-be" %}
50
50
            ({% translate "Belgian French" %})
51
51
            {% endif %}
52
52
            {{ article.title }}
53
53
        </a>
54
54
        {% endfor %}
55
55
    {% endif %}
56
56
    <hr class="half">
57
57
    {% endfor %}
58
58
  </nav>
59
59
{% endblock nav %}
60
60
61
61
{% block main %}
62
62
63
63
<section class="emphasis">
64
64
    <h1>{% trans "Blog" %}</h1>
65
65
    <p>
66
66
        {% blocktrans %}Welcome to my blog. Here, I write
67
67
        about things that interest me. Politics, coding,
68
68
        studying, life, or anything else I fancy rambling
69
69
        about. If you're in luck, I may've written it in a
70
70
        language that you understand better than English.
71
71
        {% endblocktrans %}
72
72
    </p>
73
73
</section>
74
74
75
75
<div class="fab" style="padding: 0.5em; font-size: 2em;">
76
76
    <a href="{% url 'blog-feed' %}" id="feed-fab"> 
77
77
    <!--<b>RSS</b>-->
78
78
    <img src="{% get_media_prefix %}blog/path.png">
79
79
    </a>
80
80
</div>
81
81
82
82
<section>
83
-
    <h1>Spreken is zilver, schrijven is goud</h1>
84
-
    <a class="btn fill" href="{% url "blog-archive" %}"> {% translate "Open archive" %}</a>
85
-
    {% include "blog/sizsig.html" %}
86
-
</section>
87
-
88
-
<div class="cards">
89
83
    {% for post in posts %}
90
84
        <div class="card">
+
85
        {# To enlarge the VB post a bit #}
+
86
        <div class="card" style="flex-grow: 4;">
+
87
        {% else %}
+
88
        <div class="card">
91
89
            <h3>{{ post.title }}</h3>
+
90
            <h3>{{ post.title }}</h3>
92
91
            <h4>{{ post.published|date:"DATE_FORMAT" }}</h4>
93
92
            {% if post.article %}
94
93
                {# No need for surrounding <p> tags #}
95
94
                {{ post.article.text|safe|truncatewords_html:100 }}
96
95
                {# Pandoc automatically makes those #}
97
96
                <a class="btn outline" href="{% url 'blog-post' post.article.language_code post.article.slug %}">
98
97
                    📚 {% translate "Read on" %}</a>
99
98
            {% else %}
100
99
                {% get_current_language as CUR_LANG %}
101
100
                {% get_language_info for CUR_LANG as lang %}
102
101
                {{ CUR_LANG.name_translated }}
103
102
                <p>{% blocktranslate with cur_lang=lang.name_translated %}This blog
104
103
               post is not available in {{ cur_lang }}.{% endblocktranslate %}
105
104
                    {% blocktranslate count counter=post.articles|length %}
106
105
                    However, it is available in 
107
106
                    {% plural %}
108
107
                    If you want, you can choose to read it in one of these
109
108
                    languages: <br>
110
109
                    {% endblocktranslate %}
111
110
                    {% for article in post.articles %}
112
111
                        {% if article.language_code == "nl-be" %}
113
112
                        {% translate "Flemish" %}:
114
113
                        {% elif article.language_code == "fr-be" %}
115
114
                        {% translate "Belgian French" %}:
116
115
                        {% else %}
117
116
                        {% get_language_info for article.language_code as lang %}
118
117
                        {{ lang.name_translated }}: 
119
118
                        {% endif %}
120
119
                        <a href="{% url 'blog-post' article.language_code article.slug %}">
121
120
                            {{ article.title }}
122
121
                        </a>
123
122
                        {% if not forloop.last %}<br>{% endif %}
124
123
                    {% endfor %}
125
124
                </p>
126
125
            {% endif %}
127
126
        </div>
128
127
    {% endfor %}
129
128
    {% comment %}
130
129
    {% for title, date, blog_text, link in posts %}
131
130
        <div class="card">
132
131
            <h3>{{ title }}</h3>
133
132
            <h4>{{ date|date:"DATE_FORMAT" }}</h4>
134
133
        <a class="btn outline" href="{{link}}">📚 {% translate "Read on" %}</a>
135
134
        </div>
136
135
    {% endfor %}
137
136
    {% endcomment %}
138
137
</div>
139
138
140
139
{% endblock main %}
+
140
    <h1 id="sizsig">Spreken is zilver, schrijven is goud</h1>
+
141
    <a class="btn fill" href="{% url "blog-archive" %}"> {% translate "Open archive" %}</a>
+
142
    {% include "blog/sizsig.html" %}
+
143
</section>
+
144
+
145
+
146
{% endblock main %}
141
147

templates/blog/post.djhtml

2 additions and 1 deletion.

View changes Hide changes
1
1
{% load humanize %}
2
2
{% load i18n %}
3
3
{% load static %}
4
4
5
5
6
6
{% block stylesheets %}
7
7
{{ block.super }}
8
8
<style>
9
9
pre {
10
10
    border-style: dashed;
11
11
    padding: 1em;
12
12
    display: inline-block;
13
13
}
14
14
span.bu {
15
15
    color: #FF9800;
16
16
}
17
17
span.im {
18
18
    color: #FF9800;
19
19
    font-weight: bold;
20
20
}
21
21
span.op {
22
22
    color: #33691E;
23
23
}
24
24
span.fl {
25
25
    color: #0e84b5;
26
26
}
27
27
span.dv {
28
28
    color: #00BCD4;
29
29
}
30
30
span.cf {
31
31
    color: #E91E63;
32
32
    font-weight: bold;
33
33
}
34
34
@font-face {
35
35
  font-family: 'Merriweather';
36
36
  font-style: italic;
37
37
  font-weight: 400;
38
38
  src: url({% get_static_prefix %}fonts/merriweather-400-italic.woff2) format('woff2');
39
39
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
40
40
}
41
41
@font-face {
42
42
  font-family: 'Merriweather';
43
43
  font-style: normal;
44
44
  font-weight: 400;
45
45
  src: url({% get_static_prefix %}fonts/merriweather-400-regular.woff2) format('woff2');
46
46
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
47
47
}
48
48
@font-face {
49
49
  font-family: 'Merriweather';
50
50
  font-style: normal;
51
51
  font-weight: 700;
52
52
  src: url({% get_static_prefix %}fonts/merriweather-700-regular.woff2) format('woff2');
53
53
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
54
54
}
55
55
56
56
body {
57
57
    background-color: #0d1521; /*#0d47a1; /* Material blue P900 */
58
58
}
59
59
/*
60
60
header {
61
61
    background-color: #3e2723;
62
62
}*/
63
63
section.article {
64
64
    /*background-color: #efebe9;/*rgb(210, 188, 157);*/
65
65
    font-family: Merriweather, serif;
66
66
    /*color: var(--light-black);*/
67
67
68
68
}
69
69
70
70
/*section.article @media (prefers-color-scheme: dark) {
71
71
        background-color: var(--P100);
72
72
        background-color: red;
73
73
    }*/
74
74
.comment {
75
75
    margin-left: 0.2em;
76
76
    padding-left: 0.5em;
77
77
    padding-bottom: 0.5em;
78
78
    border-left-style: solid;
79
79
    border-color: var(--primary);
80
80
}
81
81
.recently-posted {
82
82
    background-color: var(--P100);
83
83
}
84
84
85
85
span.small-detail {
86
86
    font-size: smaller;
87
87
    color: grey;
88
88
}
89
89
</style>
90
90
{% endblock stylesheets %}
91
91
92
92
{% block description %}
93
93
{{ article.text|safe|truncatewords_html:10 }}
94
-
{% endblock description %}
+
94
{#{{ article.text|safe|truncatewords_html:10 }}#}
+
95
{% endblock description %}
95
96
{% block title %}📚 {{ navbar_title }}{% endblock title %}
96
97
97
98
98
99
{% block header %}
99
100
<header>
100
101
    <label for="nav-drawer-toggle"></label>
101
102
    <h1>{{ navbar_title }}</h1>
102
103
</header>
103
104
{% endblock header %}
104
105
105
106
{% block nav %}
106
107
<input id="nav-drawer-toggle" type="checkbox">
107
108
<nav>
108
109
    <label for="nav-drawer-toggle">🡠</label>
109
110
    <h2>{% translate "Table of contents" %}</h2>
110
111
    <a class="nav-link" href="{% url "blog-index" %}">{% translate "Blog index" %}</a>
111
112
    <a class="nav-link" href="{% url "about-index" %}">{% translate "Main page" %}</a>
112
113
    <hr class="half">
113
114
    {% for header, slug in article.headings %}
114
115
    <a class="nav-link" href="#{{ slug }}">{{ header }}</a>
115
116
    {% endfor %}
116
117
</nav>
117
118
{% endblock nav %}
118
119
119
120
{% block main %}
120
121
<section class="article">
121
122
    <!--<article style="font-family:serif;">-->
122
123
    {#{{ article.text|safe }}#}
123
124
    {#{% include "/tmp/blog-file.djhtml" %}#}
124
125
    {% include djhtml_file %}
125
126
126
127
    <!--</article>-->
127
128
</section>
128
129
129
130
{% if comment_response %}
130
131
<div class="snackbar">
131
132
    {{ comment_response }}
132
133
</div>
133
134
{% endif %}
134
135
135
136
<section class="reagoj">
136
137
    <h2>{% translate "Comments" %}</h2>
137
138
    <form method="POST" action="#reagoj">
138
139
        {% csrf_token %}
139
140
        <input type="hidden" name="reaction_to" value="">
140
141
        <input type="hidden" name="post" value="{{ article.post.id }}">
141
142
        <input type="text" id="name-root" name="name" maxlength="64" required>
142
143
        <label for="name-root">{% translate "Your name" %}</label><br>
143
144
        <textarea placeholder="{% translate "Your comment" %}" rows="2" cols="30" name="text" id="text-{{ comment.id }}" maxlength="10000" required></textarea><br>
144
145
        <input type="submit" value="{% translate "Submit" %}">
145
146
    </form>
146
147
    <hr>
147
148
    {% for root_comment in root_comments %}
148
149
        {% include "blog/comment.djhtml" with comment=root_comment %}
149
150
    {% endfor %}
150
151
</section>
151
152
152
153
{% comment %}
153
154
<h5 class="white-text">{% trans "This article in other languages" %}</h5>
154
155
155
156
{% get_language_info for 'nl' as LANG %}
156
157
<a {% if dutch_link %} href="{{dutch_link}}" {% endif %}
157
158
   class="btn fill
158
159
   {% if not dutch_link %}disabled{% endif %}">
159
160
    🇧🇪 {{ LANG.name_translated}} 🇳🇱
160
161
</a>
161
162
{% get_current_language as lang %}
162
163
{% get_language_info for 'fr' as LANG %}
163
164
<a {% if french_link %} href="{{french_link}}" {% endif %}
164
165
   class="btn fill
165
166
   {% if not french_link %}disabled{% endif %}">
166
167
    🇧🇪 {{ LANG.name_translated}} 🇫🇷
167
168
</a>
168
169
{% get_language_info for 'en' as LANG %}
169
170
<a {% if english_link %} href="{{english_link}}" {% endif %}
170
171
   class="btn fill
171
172
   {% if not english_link %}disabled{% endif %}">
172
173
    🇬🇧 {{ LANG.name_translated}} 🇺🇸
173
174
</a>
174
175
{% get_language_info for 'de' as LANG %}
175
176
<a {% if german_link %} href="{{german_link}}" {% endif %}
176
177
   class="btn fill
177
178
   {% if not german_link %}disabled{% endif %}">
178
179
    🇧🇪 {{ LANG.name_translated}} 🇩🇪
179
180
</a>
180
181
{% get_language_info for 'es' as LANG %}
181
182
<a {% if spanish_link %} href="{{spanish_link}}" {% endif %}
182
183
   class="btn
183
184
   {% if not spanish_link %}disabled{% endif %}">
184
185
    🇪🇸 {{ LANG.name_translated}} 🇲🇽
185
186
</a>
186
187
{% endcomment %}
187
188
188
189
{% comment %}
189
190
<a href="{% url 'blog-post' post_slug %}" class="btn {{accent_color}} accent-4 black-text tooltipped" data-position="bottom" data-delay="50" data-tooltip="{% trans "Multilingual link. Links to the version in the viewer's preferred language." %}">🏳️‍🌈 {% trans "All available languages" %}</a>
190
191
    {# TODO: Change to rainbow flag when possible #}
191
192
{% endcomment %}
192
193
    </div>
193
194
194
195
</div>
195
196
{% endblock main %}
196
197