Skip to content

Commit 1dd6161

Browse files
authored
Change banner to nudge viewers on old editions to latest (#4006)
* Change banner to nudge viewers on old editions to latest * Smart quotes
1 parent d6d51b9 commit 1dd6161

File tree

16 files changed

+83
-67
lines changed

16 files changed

+83
-67
lines changed

src/server/helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def render_template(template, *args, **kwargs):
3434
year = kwargs.get("year", request.view_args.get("year", DEFAULT_YEAR))
3535
previous_year = get_previous_year(year)
3636
config = kwargs.get("config", get_config(year))
37+
slug = kwargs.get("slug", "")
3738

3839
# If the lang has already been set (e.g. for error pages) then use that
3940
# Otherwise the requested lang, otherwise the default lang
@@ -108,6 +109,7 @@ def render_template(template, *args, **kwargs):
108109
plural_ru=plural_ru,
109110
DEFAULT_YEAR=DEFAULT_YEAR,
110111
en_supported_years=en_supported_years,
112+
slug=slug
111113
)
112114
return flask_render_template(template, *args, **kwargs)
113115

src/server/routes.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def root(lang):
3737
@app.route("/<lang>/<year>/table-of-contents")
3838
@validate
3939
def table_of_contents(lang, year):
40-
return render_template("%s/%s/table_of_contents.html" % (lang, year))
40+
return render_template("%s/%s/table_of_contents.html" % (lang, year), slug="table-of-contents")
4141

4242

4343
@app.route("/<lang>/<year>/contributors")
@@ -47,13 +47,13 @@ def contributors(lang, year):
4747
contributors_list = list(config["contributors"].items())
4848
random.shuffle(contributors_list)
4949
config["contributors"] = dict(contributors_list)
50-
return render_template("%s/%s/contributors.html" % (lang, year), config=config)
50+
return render_template("%s/%s/contributors.html" % (lang, year), config=config, slug="contributors")
5151

5252

5353
@app.route("/<lang>/<year>/methodology")
5454
@validate
5555
def methodology(lang, year):
56-
return render_template("%s/%s/methodology.html" % (lang, year))
56+
return render_template("%s/%s/methodology.html" % (lang, year), slug="methodology")
5757

5858

5959
# Accessibility Statement needs special case handling for trailing slashes
@@ -66,7 +66,7 @@ def accessibility_statement(lang):
6666
if request.base_url[-1] == "/":
6767
return redirect("/%s/accessibility-statement" % (lang)), 301
6868
else:
69-
return render_template("%s/accessibility_statement.html" % (lang))
69+
return render_template("%s/accessibility_statement.html" % (lang), slug="accessibility-statement")
7070

7171

7272
# Search needs special case handling for trailing slashes
@@ -85,7 +85,7 @@ def search(lang):
8585
if request.base_url[-1] == "/":
8686
return redirect("/%s/search" % lang), 301
8787
else:
88-
return render_template("%s/search.html" % lang)
88+
return render_template("%s/search.html" % lang, slug="search")
8989

9090

9191
# Redirect search by year
@@ -177,6 +177,7 @@ def chapter(lang, year, chapter):
177177
prev_chapter=prev_chapter,
178178
next_chapter=next_chapter,
179179
chapter_config=chapter_config,
180+
slug=chapter
180181
)
181182

182183

@@ -219,7 +220,7 @@ def ebook(lang, year):
219220
config["contributors"].items(), key=lambda items: items[1]["name"]
220221
)
221222
config["contributors"] = dict(sorted_contributors)
222-
return render_template("%s/%s/ebook.html" % (lang, year), config=config)
223+
return render_template("%s/%s/ebook.html" % (lang, year), config=config, slug="ebook")
223224

224225

225226
# Redirect requests for http2 to new http URLs

src/templates/base/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@
384384
{% block content%}
385385
<div id="skiptocontent"><a href="#maincontent">{{ self.skip_navigation() }}</a></div>
386386
{% block announcement %}
387-
{% if self.announcement_text %}
387+
{% if self.announcement_text() %}
388388
<aside class="banner">
389389
<div class="container">
390390
{{ self.announcement_text() }}

src/templates/en/base.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
{% block intro_title %}Web Almanac{% endblock %}
1919
{% block intro_sub_title %}HTTP Archive&#8217;s annual<br> <b>state of the web</b> report{% endblock %}
2020

21-
{% block announcement_text %}
21+
{% block announcement_text -%}
22+
{%- if year < DEFAULT_YEAR -%}
2223
<p lang="en">
23-
Join our second live stream for this year's edition on Thursday, 16th January 2025 on
24-
<a href="https://www.youtube.com/live/zCiMls26CL8?si=eMsU_MmNYdL-UB4Z">YouTube</a>,
25-
or save the <a href="/static/live-stream2.ics">calendar event</a>!
24+
You’re viewing a previous edition of the Web Almanac.
25+
Check out the <a href="/{{ lang }}/{{ DEFAULT_YEAR }}/{% if chapter_lang_exists(lang, DEFAULT_YEAR, slug) or page_lang_exists(lang, DEFAULT_YEAR, slug) %}{{ slug }}{% endif %}">{{ DEFAULT_YEAR }} edition!</a>
2626
</p>
27+
{%- endif -%}
2728
{% endblock %}
2829

2930
{% block mission %}

src/templates/es/base.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
{% block intro_title %}Web Almanac{% endblock %}
1919
{% block intro_sub_title %}HTTP Archive informe del<br><b>estado de la web</b> anual{% endblock %}
2020

21-
{% block announcement_text %}
21+
{% block announcement_text -%}
22+
{%- if year < DEFAULT_YEAR -%}
2223
<p lang="en">
23-
Join our second live stream for this year's edition on Thursday, 16th January 2025 on
24-
<a href="https://www.youtube.com/live/zCiMls26CL8?si=eMsU_MmNYdL-UB4Z">YouTube</a>,
25-
or save the <a href="/static/live-stream2.ics">calendar event</a>!
24+
Estás viendo una edición anterior del Web Almanac.
25+
¡Consulta <a href="/{{ lang }}/{{ DEFAULT_YEAR }}/{% if chapter_lang_exists(lang, DEFAULT_YEAR, slug) or page_lang_exists(lang, DEFAULT_YEAR, slug) %}{{ slug }}{% endif %}">a edición de {{ DEFAULT_YEAR }}!</a>
2626
</p>
27+
{%- endif -%}
2728
{% endblock %}
2829

2930
{% block mission %}

src/templates/fr/base.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
{% block intro_title %}Web Almanac{% endblock %}
1919
{% block intro_sub_title %}Rapport annuel<br>de HTTP Archive sur<br><b>l’état du Web</b>{% endblock %}
2020

21-
{% block announcement_text %}
21+
{% block announcement_text -%}
22+
{%- if year < DEFAULT_YEAR -%}
2223
<p lang="en">
23-
Join our second live stream for this year's edition on Thursday, 16th January 2025 on
24-
<a href="https://www.youtube.com/live/zCiMls26CL8?si=eMsU_MmNYdL-UB4Z">YouTube</a>,
25-
or save the <a href="/static/live-stream2.ics">calendar event</a>!
24+
Vous consultez une édition précédente du Web Almanac.
25+
Découvrez <a href="/{{ lang }}/{{ DEFAULT_YEAR }}/{% if chapter_lang_exists(lang, DEFAULT_YEAR, slug) or page_lang_exists(lang, DEFAULT_YEAR, slug) %}{{ slug }}{% endif %}">l’édition {{ DEFAULT_YEAR }}!</a>
2626
</p>
27+
{%- endif -%}
2728
{% endblock %}
2829

2930
{% block mission %}
@@ -147,7 +148,7 @@
147148
{% endif %}
148149

149150
{% block contributors_description %}
150-
Le Web Almanac a été rendu possible grâce au travail acharné de la communauté Web. {{ self.contributors() }} personnes ont consacré bénévolement d’innombrables heures à planifier, faire des recherches, rédiger et mettre à votre disposition l'édition {{ year }} du Web Almanac.
151+
Le Web Almanac a été rendu possible grâce au travail acharné de la communauté Web. {{ self.contributors() }} personnes ont consacré bénévolement d’innombrables heures à planifier, faire des recherches, rédiger et mettre à votre disposition lédition {{ year }} du Web Almanac.
151152
{% endblock %}
152153
{% block contributors_link %}Voir les contributeurs et contributrices{% endblock %}
153154

@@ -225,7 +226,7 @@
225226
"developers": "Développement",
226227
"editors": "Édition",
227228
"leads": "Gestion de projet",
228-
"committee": "Comité d'organisation",
229+
"committee": "Comité dorganisation",
229230
"reviewers": "Relecture",
230231
"translators": "Traduction",
231232
}
@@ -239,7 +240,7 @@
239240
"developers": "Développement",
240241
"editors": "Édition",
241242
"leads": "Gestion de projet",
242-
"committee": "Comité d'organisation",
243+
"committee": "Comité dorganisation",
243244
"reviewers": "Relecture",
244245
"translators": "Traduction",
245246
}

src/templates/hi/base.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
{% block intro_title %}Web Almanac{% endblock %}
1919
{% block intro_sub_title %}HTTP Archive के वार्षिक<br> <b>वेब की स्थिति</b> की रिपोर्ट{% endblock %}
2020

21-
{% block announcement_text %}
21+
{% block announcement_text -%}
22+
{%- if year < DEFAULT_YEAR -%}
2223
<p lang="en">
23-
Join our second live stream for this year's edition on Thursday, 16th January 2025 on
24-
<a href="https://www.youtube.com/live/zCiMls26CL8?si=eMsU_MmNYdL-UB4Z">YouTube</a>,
25-
or save the <a href="/static/live-stream2.ics">calendar event</a>!
24+
आप वेब पंचांग का पिछला संस्करण देख रहे हैं।
25+
<a href="/{{ lang }}/{{ DEFAULT_YEAR }}/{% if chapter_lang_exists(lang, DEFAULT_YEAR, slug) or page_lang_exists(lang, DEFAULT_YEAR, slug) %}{{ slug }}{% endif %}">{{ DEFAULT_YEAR }} संस्करण</a> देखें!
2626
</p>
27+
{%- endif -%}
2728
{% endblock %}
2829

2930
{% block mission %}

src/templates/it/base.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@
1818
{% block intro_title %}Web Almanac{% endblock %}
1919
{% block intro_sub_title %}Rapporto annuale<br> <b>sullo stato del web</b> di HTTP Archive{% endblock %}
2020

21-
{% block announcement_text %}
21+
{% block announcement_text -%}
22+
{%- if year < DEFAULT_YEAR -%}
2223
<p lang="en">
23-
Join our second live stream for this year's edition on Thursday, 16th January 2025 on
24-
<a href="https://www.youtube.com/live/zCiMls26CL8?si=eMsU_MmNYdL-UB4Z">YouTube</a>,
25-
or save the <a href="/static/live-stream2.ics">calendar event</a>!
24+
Stai visualizzando un’edizione precedente del Web Almanac.
25+
Dai un’occhiata all’<a href="/{{ lang }}/{{ DEFAULT_YEAR }}/{% if chapter_lang_exists(lang, DEFAULT_YEAR, slug) or page_lang_exists(lang, DEFAULT_YEAR, slug) %}{{ slug }}{% endif %}">edizione del {{ DEFAULT_YEAR }}!</a>
2626
</p>
27+
{%- endif -%}
2728
{% endblock %}
2829

2930
{% block mission %}
3031
<p>
31-
La nostra missione è combinare le statistiche grezze e le tendenze del HTTP Archive con l'esperienza della comunità web. Il Web Almanac è un rapporto completo sullo stato del web, supportato da dati reali e da esperti web di fiducia. L'edizione {{ year }} è composta da {{supported_chapters | length}} capitoli che abbracciano aspetti del page content, user experience, publishing e distribution.
32+
La nostra missione è combinare le statistiche grezze e le tendenze del HTTP Archive con lesperienza della comunità web. Il Web Almanac è un rapporto completo sullo stato del web, supportato da dati reali e da esperti web di fiducia. Ledizione {{ year }} è composta da {{supported_chapters | length}} capitoli che abbracciano aspetti del page content, user experience, publishing e distribution.
3233
</p>
3334
{% endblock %}
3435

@@ -42,7 +43,7 @@
4243
{% block translation_not_available %}Inglese - non disponibile in italiano{% endblock %}
4344
{% block in_english %} (Inglese){% endblock %}
4445
{% block language_switcher %}Seleziona la lingua{% endblock %}
45-
{% block year_switcher %}Seleziona l'anno{% endblock %}
46+
{% block year_switcher %}Seleziona lanno{% endblock %}
4647
{% block table_of_contents_switcher %}Seleziona sommario{% endblock %}
4748

4849
{% block home %}Pagina iniziale{% endblock %}
@@ -155,7 +156,7 @@
155156
{% block methodology_stat_2_title %}Dati trattati{% endblock %}
156157
{% block methodology_link %}Scopri la nostra metodologia{% endblock %}
157158
{% block methodology_description %}
158-
Se non diversamente specificato, le metriche in tutti i {{ supported_chapters | length }} capitoli del Web Almanac {{ year }} provengono dal dataset dell'archivio HTTP. HTTP Archive è un progetto gestito dalla comunità che tiene traccia del modo in cui è costruito il Web dal 2010. Utilizzando WebPageTest e Lighthouse "under the hood", i metadati di {{ self.total_websites() }} di siti Web vengono testati mensilmente e inclusi in un database BigQuery pubblico per l'analisi. Il set di dati di {{ self.dataset() }} è stato utilizzato come base per le metriche del Web Almanac {{ year }}. Per ulteriori informazioni, vedere la pagina Methodology.
159+
Se non diversamente specificato, le metriche in tutti i {{ supported_chapters | length }} capitoli del Web Almanac {{ year }} provengono dal dataset dellarchivio HTTP. HTTP Archive è un progetto gestito dalla comunità che tiene traccia del modo in cui è costruito il Web dal 2010. Utilizzando WebPageTest e Lighthouse "under the hood", i metadati di {{ self.total_websites() }} di siti Web vengono testati mensilmente e inclusi in un database BigQuery pubblico per lanalisi. Il set di dati di {{ self.dataset() }} è stato utilizzato come base per le metriche del Web Almanac {{ year }}. Per ulteriori informazioni, vedere la pagina Methodology.
159160
{% endblock %}
160161

161162
{% block introduction %}Introduzione{% endblock %}
@@ -169,13 +170,13 @@
169170

170171
{% block ebook_title %}Ebook{% endblock %}
171172
{% block ebook_download_short %}Ebook PDF ({{ ebook_size_in_mb }}MB){% endblock %}
172-
{% block ebook_download %}Download l'intera Web Almanac del {{ year }} in formato PDF ({{ ebook_size_in_mb }}MB){% endblock %}
173+
{% block ebook_download %}Download lintera Web Almanac del {{ year }} in formato PDF ({{ ebook_size_in_mb }}MB){% endblock %}
173174
{% block ebook_download_note %}(Generato con <a href="https://www.princexml.com/">www.princexml.com</a>){% endblock %}
174175

175176
{%
176177
set localizedPartTitles = {
177178
"I. Page Content": "I. Contenuto della Pagina",
178-
"II. User Experience": "II. L'Esperienza Utente",
179+
"II. User Experience": "II. LEsperienza Utente",
179180
"III. Content Publishing": "III. Pubblicazione di Contenuti",
180181
"IV. Content Distribution": "IV. Distribuzione dei Contenuti"
181182
}

src/templates/ja/base.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
{% block intro_title %}Web Almanac{% endblock %}
1919
{% block intro_sub_title %}HTTP Archiveの年次報告書<br> <b>ウェブの状態</b>レポート{% endblock %}
2020

21-
{% block announcement_text %}
21+
{% block announcement_text -%}
22+
{%- if year < DEFAULT_YEAR -%}
2223
<p lang="en">
23-
Join our second live stream for this year's edition on Thursday, 16th January 2025 on
24-
<a href="https://www.youtube.com/live/zCiMls26CL8?si=eMsU_MmNYdL-UB4Z">YouTube</a>,
25-
or save the <a href="/static/live-stream2.ics">calendar event</a>!
24+
ご覧になっているのは、Web Almanac の以前の版です。
25+
<a href="/{{ lang }}/{{ DEFAULT_YEAR }}/{% if chapter_lang_exists(lang, DEFAULT_YEAR, slug) or page_lang_exists(lang, DEFAULT_YEAR, slug) %}{{ slug }}{% endif %}">{{ DEFAULT_YEAR }} 年版</a>をご覧ください。
2626
</p>
27+
{%- endif -%}
2728
{% endblock %}
2829

2930
{% block mission %}

src/templates/nl/base.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
{% block intro_title %}Web Almanac{% endblock %}
1919
{% block intro_sub_title %}HTTP Archive&#8217;s jaarlijkse<br><b>staat van het web</b>rapport{% endblock %}
2020

21-
{% block announcement_text %}
21+
{% block announcement_text -%}
22+
{%- if year < DEFAULT_YEAR -%}
2223
<p lang="en">
23-
Join our second live stream for this year's edition on Thursday, 16th January 2025 on
24-
<a href="https://www.youtube.com/live/zCiMls26CL8?si=eMsU_MmNYdL-UB4Z">YouTube</a>,
25-
or save the <a href="/static/live-stream2.ics">calendar event</a>!
24+
U bekijkt een eerdere editie van de Web Almanac.
25+
Bekijk de <a href="/{{ lang }}/{{ DEFAULT_YEAR }}/{% if chapter_lang_exists(lang, DEFAULT_YEAR, slug) or page_lang_exists(lang, DEFAULT_YEAR, slug) %}{{ slug }}{% endif %}">editie van {{ DEFAULT_YEAR }}!</a>
2626
</p>
27+
{%- endif -%}
2728
{% endblock %}
2829

2930
{% block mission %}

0 commit comments

Comments
 (0)