Skip to content

Commit

Permalink
Merge branch 'SLB-497-centralised-seo-settings' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
chindris committed Jan 13, 2025
2 parents 3ae1aee + 573eed7 commit 7ba7ba0
Show file tree
Hide file tree
Showing 3 changed files with 212 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/website/src/templates/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export function Head({ data }: HeadProps<typeof query>) {
key={`link-${index}`}
rel={metaTag.attributes?.rel}
href={metaTag.attributes?.href}
type={
metaTag.attributes?.rel === 'image_src' ? 'image' : undefined
}
/>
);
}
Expand Down
3 changes: 3 additions & 0 deletions apps/website/src/templates/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export function Head({ data }: HeadProps<typeof query>) {
key={`link-${index}`}
rel={metaTag.attributes?.rel}
href={metaTag.attributes?.href}
type={
metaTag.attributes?.rel === 'image_src' ? 'image' : undefined
}
/>
);
}
Expand Down
206 changes: 206 additions & 0 deletions tests/schema/specs/content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ test('Page', async () => {
complete: _loadDrupalPage(id: "ef80e284-154b-41fd-9317-154b0a175299") {
...Page
}
seo_all_empty: _loadDrupalPage(
id: "5f108e07-62ca-4025-adca-069b3adfc22c"
) {
translations {
...Page
}
}
seo_all_filled_in: _loadDrupalPage(
id: "6344bdc5-1b02-4542-b4ae-4e6df23b3e4c"
) {
translations {
...Page
}
}
}
`);
expect(result).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -79,6 +93,198 @@ test('Page', async () => {
},
"title": "Page: complete",
},
"seo_all_empty": {
"translations": [
{
"content": [
{
"__typename": "BlockMarkup",
},
],
"hero": {
"__typename": "Hero",
},
"locale": "en",
"metaTags": [
{
"attributes": {
"content": "SEO test - all empty | Silverback Drupal Template",
"href": null,
"name": "title",
"property": null,
"rel": null,
},
"tag": "meta",
},
{
"attributes": {
"content": null,
"href": "http://127.0.0.1:8000/en/seo-test-all-empty",
"name": null,
"property": null,
"rel": "canonical",
},
"tag": "link",
},
],
"path": "/en/seo-test-all-empty",
"teaserImage": null,
"title": "SEO test - all empty",
},
{
"content": [
{
"__typename": "BlockMarkup",
},
],
"hero": {
"__typename": "Hero",
},
"locale": "de",
"metaTags": [
{
"attributes": {
"content": "SEO test - all empty DE | Silverback Drupal Template",
"href": null,
"name": "title",
"property": null,
"rel": null,
},
"tag": "meta",
},
{
"attributes": {
"content": null,
"href": "http://127.0.0.1:8000/de/seo-test-all-empty-de",
"name": null,
"property": null,
"rel": "canonical",
},
"tag": "link",
},
],
"path": "/de/seo-test-all-empty-de",
"teaserImage": null,
"title": "SEO test - all empty DE",
},
],
},
"seo_all_filled_in": {
"translations": [
{
"content": [
{
"__typename": "BlockMarkup",
},
],
"hero": {
"__typename": "Hero",
},
"locale": "en",
"metaTags": [
{
"attributes": {
"content": "Overwritten SEO title | Silverback Drupal Template",
"href": null,
"name": "title",
"property": null,
"rel": null,
},
"tag": "meta",
},
{
"attributes": {
"content": "SEO description",
"href": null,
"name": "description",
"property": null,
"rel": null,
},
"tag": "meta",
},
{
"attributes": {
"content": null,
"href": "http://127.0.0.1:8000/en/seo-test-all-filled",
"name": null,
"property": null,
"rel": "canonical",
},
"tag": "link",
},
{
"attributes": {
"content": null,
"href": "/sites/default/files/2024-04/the_silverback.jpeg",
"name": null,
"property": null,
"rel": "image_src",
},
"tag": "link",
},
],
"path": "/en/seo-test-all-filled",
"teaserImage": null,
"title": "SEO test - all filled in",
},
{
"content": [
{
"__typename": "BlockMarkup",
},
],
"hero": {
"__typename": "Hero",
},
"locale": "de",
"metaTags": [
{
"attributes": {
"content": "Overwritten SEO title DE | Silverback Drupal Template",
"href": null,
"name": "title",
"property": null,
"rel": null,
},
"tag": "meta",
},
{
"attributes": {
"content": "SEO description DE",
"href": null,
"name": "description",
"property": null,
"rel": null,
},
"tag": "meta",
},
{
"attributes": {
"content": null,
"href": "http://127.0.0.1:8000/de/seo-test-all-filled-de",
"name": null,
"property": null,
"rel": "canonical",
},
"tag": "link",
},
{
"attributes": {
"content": null,
"href": "/sites/default/files/2024-04/the_silverback.jpeg",
"name": null,
"property": null,
"rel": "image_src",
},
"tag": "link",
},
],
"path": "/de/seo-test-all-filled-de",
"teaserImage": null,
"title": "SEO test - all filled in DE",
},
],
},
},
}
`);
Expand Down

0 comments on commit 7ba7ba0

Please sign in to comment.