Skip to content

Commit 7392e2a

Browse files
chore: canonicalize canonical announcements to canonical.com, and all others to ubuntu.com
1 parent 909a95d commit 7392e2a

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

templates/blog/article.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "base_index.html" %}
22

3+
{% set is_canonical_announcement = article.group and article.group.slug == "canonical-announcements" %}
4+
35
{% block title %}{{ article.title.rendered|safe }}{% endblock %}
46

57
{% block meta_description %}{{ article.meta_description }}{% endblock %}
@@ -11,12 +13,8 @@
1113
{% block meta_image %}{{ article.image.source_url }}{% endblock %}
1214

1315
{%- block canonical_url -%}
14-
{%- if article.author and article.author.id == 217 -%}
16+
{%- if is_canonical_announcement -%}
1517
https://canonical.com/blog/{{ article.slug }}
16-
{%- elif 2996 in article.tags -%}
17-
https://snapcraft.io/blog/{{ article.slug }}
18-
{%- elif 1304 in article.tags or 3681 in article.tags -%}
19-
https://maas.io/blog/{{ article.slug }}
2018
{%- else -%}
2119
https://ubuntu.com/blog/{{ article.slug }}
2220
{%- endif -%}
@@ -27,22 +25,22 @@
2725
<script type="application/ld+json" nonce="{{ csp_nonce }}">
2826
{
2927
"@context": "http://schema.org",
30-
"@id": "https://canonical.com/#article",
28+
"@id": "{{ request.url }}",
3129
"@type": "Article",
32-
"name": "{{ article.title.renderered|safe }}",
30+
"name": "{{ article.title.rendered | safe }}",
3331
"headline": "{{ article.excerpt.raw }}",
3432
"author": {
35-
"@type": "Person",
33+
"@type": "{% if article.author.slug == 'canonical' %}Organization{% else %}Person{% endif %}",
3634
"name": "{{ article.author.name }}"
3735
},
3836
"datePublished": "{{ article.date_gmt }}",
3937
{% if article.image and article.image.source_url %}
4038
"image": "{{ article.image.source_url }}",
4139
{% endif %}
42-
"url": "{{ request.url }}",
40+
"url": "{{ self.canonical_url() }}",
4341
"publisher": {
4442
"@type": "Organization",
45-
"name": "Ubuntu"
43+
"name": "{% if is_canonical_announcement %}Canonical{% else %}Ubuntu{% endif %}"
4644
}
4745
}
4846
</script>

0 commit comments

Comments
 (0)