Skip to content

Commit f8d90de

Browse files
fix: titles (#856)
New changes to fix titles added for datagouv/data.gouv.fr#1886 The issue contained improper SEO recommendations
1 parent 2814759 commit f8d90de

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

pages/dataservices/[did].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ const { height: headerHeight } = useElementSize(header)
274274
const url = computed(() => `/api/1/dataservices/${route.params.did}/`)
275275
const { data: dataservice, status } = await useAPI<Dataservice>(url, { redirectOn404: true, redirectOnSlug: 'did' })
276276
277-
const title = computed(() => `${dataservice.value?.title} | ${config.public.title}`)
277+
const title = computed(() => `API - ${dataservice.value?.title} | ${config.public.title}`)
278278
const description = computed(() => dataservice.value?.description)
279279
const robots = computed(() => dataservice.value && dataservice.value.archived_at ? 'noindex' : 'all')
280280

pages/datasets/[did].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ const { data: dataset, status } = await useAPI<DatasetV2WithFullObject>(url, {
508508
redirectOnSlug: 'did',
509509
})
510510
511-
const title = computed(() => t('Jeu de données {title} | {site}', { title: dataset.value?.title ?? '', site: config.public.title }))
511+
const title = computed(() => t('Jeu de données - {title} | {site}', { title: dataset.value?.title ?? '', site: config.public.title }))
512512
const robots = computed(() => dataset.value && dataset.value.archived ? 'noindex' : 'all')
513513
const description = computed(() => dataset.value?.description_short)
514514

pages/organizations/[oid].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const me = useMaybeMe()
101101
const url = computed(() => `/api/1/organizations/${route.params.oid}/`)
102102
const { data: organization, status } = await useAPI<Organization>(url, { redirectOn404: true, redirectOnSlug: 'oid' })
103103
104-
const title = computed(() => organization.value?.name)
104+
const title = computed(() => `Organisation - ${organization.value?.name} | ${config.public.title}`)
105105
const robots = computed(() => organization.value && !organization.value.metrics.dataservices && !organization.value.metrics.datasets && !organization.value.metrics.reuses ? 'noindex, nofollow' : 'all')
106106
107107
useSeoMeta({

pages/reuses/[rid].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ const config = useRuntimeConfig()
187187
const url = computed(() => `/api/1/reuses/${route.params.rid}/`)
188188
const { data: reuse, status } = await useAPI<Reuse>(url, { redirectOn404: true, redirectOnSlug: 'rid' })
189189
190-
const title = computed(() => `${reuse.value?.title} | ${config.public.title}`)
190+
const title = computed(() => `Réutilisation - ${reuse.value?.title} | ${config.public.title}`)
191191
const description = computed(() => reuse.value?.description ?? '')
192192
const robots = computed(() => reuse.value && !reuse.value.metrics.datasets && !reuse.value.metrics.datasets ? 'noindex, nofollow' : 'all')
193193

tests/dataservices/[did].spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const DATASERVICE_SLUG = 'explore-api-v2-30'
55
test('page loads with correct title', async ({ page }) => {
66
await page.goto(`/dataservices/${DATASERVICE_SLUG}`)
77

8-
await expect(page).toHaveTitle(/explore/i)
8+
await expect(page).toHaveTitle('API - Explore API v2 | data.gouv.fr')
99

1010
await expect(page.getByRole('heading', { level: 1 })).toBeVisible()
1111
})

tests/datasets/[did].spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test('show details page', async ({ page }) => {
77

88
// Expect a title "to contain" a substring.
99
await expect(page).toHaveTitle(
10-
'Jeu de données Base Sirene des entreprises et de leurs établissements (SIREN, SIRET) | data.gouv.fr',
10+
'Jeu de données - Base Sirene des entreprises et de leurs établissements (SIREN, SIRET) | data.gouv.fr',
1111
)
1212
})
1313

@@ -17,7 +17,7 @@ test('dataset with labels shows label section', async ({ page }) => {
1717
)
1818

1919
await expect(page).toHaveTitle(
20-
'Jeu de données Base Sirene des entreprises et de leurs établissements (SIREN, SIRET) | data.gouv.fr',
20+
'Jeu de données - Base Sirene des entreprises et de leurs établissements (SIREN, SIRET) | data.gouv.fr',
2121
)
2222

2323
// Check that there's a corresponding dd element with labels

tests/organizations/[oid].spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const ORG_SLUG = 'sobrana'
55
test('page loads with correct organization name', async ({ page }) => {
66
await page.goto(`/organizations/${ORG_SLUG}`)
77

8-
await expect(page).toHaveTitle(/sobrana/i)
8+
await expect(page).toHaveTitle('Organisation - SOBRANA | data.gouv.fr')
99

1010
// Verify organization name in heading
1111
await expect(page.getByRole('heading', { level: 1, name: /SOBRANA/i })).toBeVisible()

tests/reuses/[rid].spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const REUSE_SLUG = 'itineriz-deplacements-professionnels-jop-paris-2024'
55
test('page loads with correct title', async ({ page }) => {
66
await page.goto(`/reuses/${REUSE_SLUG}`)
77

8-
await expect(page).toHaveTitle(/itineriz/i)
8+
await expect(page).toHaveTitle('Réutilisation - Itineriz - Déplacements professionnels JOP Paris 2024 | data.gouv.fr')
99

1010
await expect(page.getByRole('heading', { level: 1 })).toBeVisible()
1111
})

0 commit comments

Comments
 (0)