Skip to content

Commit dcf456e

Browse files
authored
Merge pull request #544 from canada-ca/hotfix/style-guide-thumbnail
Update metadata and add cover image for Canada.ca Content Style Guide
2 parents 65d7786 + d04932e commit dcf456e

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

_config.staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ analytics:
33
# adobe:
44
# tracking_id: be5dfd287373/0127575cd23a/launch-913b1beddf7a-staging
55
# service: TBS-DTO-TEST_TEST-BTN-SCT
6-
url: ""
6+
url: "DEPLOY_PRIME_URL"

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"remote_theme": "wet-boew/gcweb-jekyll",
6565
"themeopt": "Policies",
6666
"title": "Canada.ca design",
67-
"url": "",
67+
"url": "https://design.canada.ca",
6868
"urlconception": "https://conception.canada.ca",
6969
"urlcanadaca": "https://www.canada.ca",
7070
"urlblogca": "https://blog.canada.ca",

_includes/metadata.html

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<!-- Custom code starts here (Metadata) / Code personalisé commence ici (Métadonnées) -->
2-
<link rel="canonical" href="{{ page.url | remove_first: '/' | remove_first: page.lang | prepend: site.altLangUrl[ page.lang ] }}" />
3-
<link rel="alternate" href="{{ page.altLangPage | prepend: site.altLangUrl[ i18nText-altLang ] }}" hreflang="{{ i18nText-altLang }}" />
2+
<link rel="canonical" href="{{ page.url | absolute_url }}" />
3+
<link rel="alternate" href="{{ page.altLangPage }}" hreflang="{{ i18nText-altLang }}" />
44
{%- if page.description %}
55
<meta name="description" content="{{ page.description }}" />
6+
{%- if page.image %}
7+
<meta name="og:description" content="{{ page.description }}" />
8+
<meta name="twitter:description" content="{{ page.description }}" />
9+
{% endif %}
610
{%- elsif site.description %}
711
<meta name="description" content="{{ site.description[ page.lang ] }}" />
812
{%- endif %}
@@ -33,23 +37,23 @@
3337
<meta name="dcterms.service" content="{{ site.analytics.providers.adobe.service }}">
3438
{%- endif %}
3539
<meta name="generator" content="Jekyll v{{ jekyll.version }}" />
36-
{%- if page.layout == "post" %}
40+
{%- if page.layout == "post" or page.image %}
3741
{%- if page.title %}
3842
<meta property="og:title" content="{{ page.title }}" />
3943
<meta property="twitter:title" content="{{ page.title }}" />
4044
{%- endif %}
4145
<meta property="og:locale" content="{{ page.lang | append: '_CA' }}" />
42-
<meta property="og:url" content="{{ site.urlalt[ page.lang ] }}{{ page.url | remove_first: '/' | remove_first: page.lang }}" />
46+
<meta property="og:url" content="{{ page.url | absolute_url }}" />
4347
{%- if page.image %}
44-
{%- capture ogimage -%}{{ page.lang | prepend: '/' }}/images/{{ page.date | date: "%F" | prepend: "og-" }}.png{%- endcapture -%}
48+
{%- capture ogimage -%}/images/thumbs/{{ page.image.filename }}{%- endcapture -%}
4549
{%- assign file_exists = site.static_files | where: "path", ogimage -%}
4650

4751
{%- if file_exists[0].path %}
48-
<meta property="og:image" content="{{ site.urlalt[ page.lang ] }}{{ ogimage | remove_first: '/' | remove_first: page.lang }}" />
49-
<meta property="twitter:image" content="{{ site.urlalt[ page.lang ] }}{{ ogimage | remove_first: '/' | remove_first: page.lang }}" />
52+
<meta property="og:image" content="{{ ogimage | absolute_url }}" />
53+
<meta property="twitter:image" content="{{ ogimage | absolute_url }}" />
5054
{%- else %}
51-
<meta property="og:image" content="{{ site.urlalt[ page.lang ] }}/images/thumbs/{{ page.date | date: '%F' }}.png" />
52-
<meta property="twitter:image" content="{{ site.urlalt[ page.lang ] }}/images/thumbs/{{ page.date | date: '%F' }}.png" />
55+
<meta property="og:image" content="{{ site.url }}/images/thumbs/{{ page.date | date: '%F' }}.png" />
56+
<meta property="twitter:image" content="{{ site.url }}/images/thumbs/{{ page.date | date: '%F' }}.png" />
5357
{%- endif %}
5458

5559
{%- if page.image.height %}
@@ -80,7 +84,7 @@
8084
{%- endif %}
8185

8286
{%- if site.title %}
83-
<meta property="og:site_name" content="{{ site.title[ page.lang ] }}" />
87+
<meta property="og:site_name" content="{{ site.title }}" />
8488
{%- endif -%}
8589

8690
{%- if paginator.previous_page %}

images/thumbs/sg-preview-img.png

6.26 KB
Loading

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[context.deploy-preview]
22
# const url = process.env.DEPLOY_URL
3-
command = "bundle exec jekyll build --config _config.yml,_config.staging.yml"
3+
command = "sed -i.bak 's|DEPLOY_PRIME_URL|'${DEPLOY_PRIME_URL}'|g' _config.staging.yml && bundle exec jekyll build --config _config.yml,_config.staging.yml"

style-guide/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ altLangPage: "https://conception.canada.ca/guide-redaction"
33
date: 2017-10-05
44
dateModified: 2024-08-06
55
description: "The Canada.ca Content Style Guide provides the rules to create web content that can be easily found, understood and used."
6+
image:
7+
filename: sg-preview-img.png
8+
alt: "Canada.ca Content Style Guide cover image"
69
title: "Canada.ca Content Style Guide"
710
---
11+
812
<section id="intro">
913
<p>These are the rules to create web content that can be easily found, understood and used. They are based on writing principles and techniques that help make web content clear and adapted to the needs of all people. Use it with the <a href="{{ site.url }}/architecture/canada-content-information-architecture-specification.html">Canada.ca Specifications</a> when you're designing and organizing web content.</p>
1014
</section>

0 commit comments

Comments
 (0)