Skip to content

Commit 685cf41

Browse files
committed
Refactor content type logic and remove language link column
- Create shared content type macro in src/_includes/macros/contentType.njk - Update HTML table and CSV templates to use unified content type logic - Remove 'Other language link' column from HTML page list table - Maintain UTF-8 BOM encoding and French translations in CSV exports This ensures consistency between HTML table and CSV exports while simplifying the table interface.
1 parent 1029f71 commit 685cf41

File tree

4 files changed

+17
-65
lines changed

4 files changed

+17
-65
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{%- macro getContentType(inputPath, locale) -%}
2+
{%- if '/main/' in inputPath -%}
3+
{%- if locale === "en" -%}Landing Page{%- else -%}Page d'atterrissage{%- endif -%}
4+
{%- elif '/pages/' in inputPath -%}
5+
{%- if locale === "en" -%}Content Page{%- else -%}Page de contenu{%- endif -%}
6+
{%- elif '/links/' in inputPath -%}
7+
{%- if locale === "en" -%}Link{%- else -%}Lien{%- endif -%}
8+
{%- else -%}
9+
Page
10+
{%- endif -%}
11+
{%- endmacro -%}

src/_includes/partials/pageListTable.njk

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% set branch = "main" %}
2+
{% from "macros/contentType.njk" import getContentType %}
23

34
</div>
45
<div class="container-fluid">
@@ -63,11 +64,6 @@
6364
<input type="checkbox" name="columns" class="wb-tagfilter-ctrl" value="col_1" checked> {% if locale === "en" %}Title{% else %}Titre{% endif %}
6465
</label>
6566
</li>
66-
<li class="checkbox">
67-
<label>
68-
<input type="checkbox" name="columns" class="wb-tagfilter-ctrl" value="col_2" checked> {% if locale === "en" %}Other language link{% else %}Lien vers d'autres langues{% endif %}
69-
</label>
70-
</li>
7167
<li class="checkbox">
7268
<label>
7369
<input type="checkbox" name="columns" class="wb-tagfilter-ctrl" value="col_3" checked> {{ pageList[locale].tagsText }}
@@ -126,7 +122,6 @@
126122
<thead>
127123
<tr>
128124
<th data-wb-tags="col_1">{% if locale === "en" %}Title{% else %}Titre{% endif %}</th>
129-
<th data-wb-tags="col_2">{% if locale === "en" %}Other language link{% else %}Lien vers d'autres langues{% endif %}</th>
130125
<th data-wb-tags="col_3">{{ pageList[locale].tagsText }}</th>
131126
<th data-wb-tags="col_4">{{ pageList[locale].subjectsText }}</th>
132127
<th data-wb-tags="col_5">{% if locale === "en" %}Role{% else %}Rôle{% endif %}</th>
@@ -148,45 +143,13 @@
148143
{% else %}
149144
{% set missingToggle = "Version anglais manquante" %}
150145
{% endif %}
151-
{% if '/main/' in entry.inputPath %}
152-
{% if locale === "en" %}
153-
{% set contentType = "Landing Page" %}
154-
{% else %}
155-
{% set contentType = "Page d'atterrissage" %}
156-
{% endif %}
157-
{% elif '/pages/' in entry.inputPath %}
158-
{% if locale === "en" %}
159-
{% set contentType = "Content Page" %}
160-
{% else %}
161-
{% set contentType = "Page de contenu" %}
162-
{% endif %}
163-
{% elif '/links/' in entry.inputPath %}
164-
{% if locale === "en" %}
165-
{% set contentType = "Link" %}
166-
{% else %}
167-
{% set contentType = "Lien" %}
168-
{% endif %}
169-
{% else %}
170-
{% if locale === "en" %}
171-
{% set contentType = "Page" %}
172-
{% else %}
173-
{% set contentType = "Page" %}
174-
{% endif %}
175-
{% endif %}
176146
{% if entry.data.locale == locale %}
177147
{% if entry.data.redirect %}
178148
{% elif entry.inputPath.endsWith('.csv.njk') %}
179149
{% else %}
180150
<tr{% for items in isLanding[6] %}{% if items === "m" %} class="success" data-wb-tags="isLanding"{% else %} data-wb-tags="isPage"{% endif %}{% endfor %}>
181151
<td data-wb-tags="col_1">
182152
<a href="{{ entry.url }}">{{ entry.data.title | safe }}</a></td>
183-
<td data-wb-tags="col_2">
184-
{% if entry.data.toggle %}
185-
<a href="{{ pathPrefix }}{{ otherLocale }}/{{ entry.data.toggle }}" hreflang="{{ otherLang }}">{% if locale === "en" %}French version{% else %}Version anglaise{% endif %} <span class="wb-inv">{% if locale === "en" %}of{% else %}de{% endif %} {{ entry.data.title | safe }}</span></a>
186-
{% else %}
187-
<strong>{{ missingToggle }}</strong>
188-
{% endif %}
189-
</td>
190153
<td data-wb-tags="col_3">
191154
{% for item in entry.data.tags %}
192155
<span class="label label-info">{{ item }}</span>
@@ -204,7 +167,7 @@
204167
<td data-wb-tags="col_6">{{ entry.data.layout or "" }}</td>
205168
<td data-wb-tags="col_7">{{ entry.date | postDate if entry.date else "" }}</td>
206169
<td data-wb-tags="col_8">{{ entry.data.gitCreated | postDate if entry.data.gitCreated else "" }}</td>
207-
<td data-wb-tags="col_9">{{ contentType }}</td>
170+
<td data-wb-tags="col_9">{{ getContentType(entry.inputPath, locale) }}</td>
208171
<td data-wb-tags="col_10"><code><a href="https://github.com/gc-da11yn/gc-da11yn.github.io/tree/{{ branch }}{{ newPath }}">{{ newPath }}</a></code></td>
209172
</tr>
210173
{% endif %}

src/main/en/pages.csv.njk

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ layout: false
44
eleventyExcludeFromCollections: true
55
date: "git Last Modified"
66
---
7+
{%- from "macros/contentType.njk" import getContentType -%}
78
{%- set roles_data = roles -%}
89
{%- macro csv(val) -%}
910
"{{ (val | default('') | string | replace('"', '""')) }}"
@@ -36,18 +37,6 @@ date: "git Last Modified"
3637
{%- endif -%}
3738
{%- endif -%}
3839
{%- endmacro -%}
39-
40-
{%- macro getContentType(inputPath) -%}
41-
{%- if '/main/' in inputPath -%}
42-
Landing Page
43-
{%- elif '/pages/' in inputPath -%}
44-
Content Page
45-
{%- elif '/links/' in inputPath -%}
46-
Link
47-
{%- else -%}
48-
Page
49-
{%- endif -%}
50-
{%- endmacro -%}
5140
Title,URL,Roles (keys),Subjects,Tags,Toggle,Layout,Date Modified,Date Created,Content Type,Source
5241
{% for item in (collections.all | localeMatch('en')) %}
5342
{%- if item.data.permalink != false and not item.data.redirect and not item.inputPath.endsWith('.csv.njk') -%}
@@ -59,6 +48,6 @@ Title,URL,Roles (keys),Subjects,Tags,Toggle,Layout,Date Modified,Date Created,Co
5948
{%- set layoutVal = item.data.layout -%}
6049
{%- set modifiedVal = item.date | postDate -%}
6150
{%- set createdVal = item.data.gitCreated | postDate if item.data.gitCreated else settings.dateCreated -%}
62-
{{ csv(item.data.title | striptags) }},{{ csv(urlVal) }},{{ csv(listify(roleVal)) }},{{ csv(listify(subjectsVal)) }},{{ csv(listify(tagsVal)) }},{{ csv(toggleVal) }},{{ csv(layoutVal) }},{{ csv(modifiedVal) }},{{ csv(createdVal) }},{{ csv(getContentType(item.inputPath)) }},{{ csv(item.inputPath) }}
51+
{{ csv(item.data.title | striptags) }},{{ csv(urlVal) }},{{ csv(listify(roleVal)) }},{{ csv(listify(subjectsVal)) }},{{ csv(listify(tagsVal)) }},{{ csv(toggleVal) }},{{ csv(layoutVal) }},{{ csv(modifiedVal) }},{{ csv(createdVal) }},{{ csv(getContentType(item.inputPath, "en")) }},{{ csv(item.inputPath) }}
6352
{% endif -%}
6453
{%- endfor %}

src/main/fr/pages.csv.njk

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ layout: false
44
eleventyExcludeFromCollections: true
55
date: "git Last Modified"
66
---
7+
{%- from "macros/contentType.njk" import getContentType -%}
78
{%- set roles_data = roles -%}
89
{%- macro csv(val) -%}
910
"{{ (val | default('') | string | replace('"', '""')) }}"
@@ -36,18 +37,6 @@ date: "git Last Modified"
3637
{%- endif -%}
3738
{%- endif -%}
3839
{%- endmacro -%}
39-
40-
{%- macro getContentType(inputPath) -%}
41-
{%- if '/main/' in inputPath -%}
42-
Page d'atterrissage
43-
{%- elif '/pages/' in inputPath -%}
44-
Page de contenu
45-
{%- elif '/links/' in inputPath -%}
46-
Lien
47-
{%- else -%}
48-
Page
49-
{%- endif -%}
50-
{%- endmacro -%}
5140
Titre,URL,Rôles (clés),Sujets,Étiquettes,Basculer,Mise en page,Date de modification,Date de création,Type de contenu,Source
5241
{% for item in (collections.all | localeMatch('fr')) %}
5342
{%- if item.data.permalink != false and not item.data.redirect and not item.inputPath.endsWith('.csv.njk') -%}
@@ -59,6 +48,6 @@ Titre,URL,Rôles (clés),Sujets,Étiquettes,Basculer,Mise en page,Date de modifi
5948
{%- set layoutVal = item.data.layout -%}
6049
{%- set modifiedVal = item.date | postDate -%}
6150
{%- set createdVal = item.data.gitCreated | postDate if item.data.gitCreated else settings.dateCreated -%}
62-
{{ csv(item.data.title | striptags) }},{{ csv(urlVal) }},{{ csv(listify(roleVal)) }},{{ csv(listify(subjectsVal)) }},{{ csv(listify(tagsVal)) }},{{ csv(toggleVal) }},{{ csv(layoutVal) }},{{ csv(modifiedVal) }},{{ csv(createdVal) }},{{ csv(getContentType(item.inputPath)) }},{{ csv(item.inputPath) }}
51+
{{ csv(item.data.title | striptags) }},{{ csv(urlVal) }},{{ csv(listify(roleVal)) }},{{ csv(listify(subjectsVal)) }},{{ csv(listify(tagsVal)) }},{{ csv(toggleVal) }},{{ csv(layoutVal) }},{{ csv(modifiedVal) }},{{ csv(createdVal) }},{{ csv(getContentType(item.inputPath, "fr")) }},{{ csv(item.inputPath) }}
6352
{% endif -%}
6453
{%- endfor %}

0 commit comments

Comments
 (0)