Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/722 seo meta refactor #784

Merged
merged 9 commits into from
Oct 9, 2023
2 changes: 1 addition & 1 deletion .cprc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"name": "ci"
},
{
"description": "Changes that affect the build system or external dependencies (example scopes: docker, npm).",
"description": "build: Use this for ongoing work that should be tracked in the changelog.",
"name": "build"
},
{
Expand Down
4 changes: 2 additions & 2 deletions .cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
},
{
"value": "build",
"name": "build: Changes that affect the build system or external dependencies (example scopes: pip, docker, npm).",
"name": "build: Use this for ongoing work that should be tracked in the changelog.",
"key": "b"
},
{
Expand Down Expand Up @@ -190,4 +190,4 @@
]
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion _ci/backstop/scenarios/cats/cats_navigate_from_post.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
viewports: aboveSmallViewports,
onReadyScript: 'playwright/onReadyCats.js',
clickSelector: '.post .aside a[href="/posts/category/thoughts/"]',
postInteractionWait: 1000,
postInteractionWait: 3000,
selectors: ['document'],
selectorExpansion: false,
misMatchThreshold: 0.2,
Expand Down
2 changes: 2 additions & 0 deletions back/config/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ module.exports = ({ env }) => {
60 * 60 * 24 * 7
),
Bucket: env("AWS_S3_BUCKET"),
CacheControl:
"max-age=2853213,public,s-maxage=31536000,immutable",
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion front/src/hooks.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PUBLIC_ENV, PUBLIC_SENTRY_DSN } from '$env/static/public';

Sentry.init({
dsn: PUBLIC_SENTRY_DSN,
debug: PUBLIC_ENV === 'development' ? true : false,
debug: PUBLIC_ENV === 'development' ? false : false,
environment: PUBLIC_ENV,
integrations: [new Sentry.BrowserTracing(), new Sentry.Replay()],
tracePropagationTargets: ['localhost', /^https:\/\/\*\.dgrebb\.com\/api/],
Expand Down
2 changes: 1 addition & 1 deletion front/src/hooks.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function handleError({ error, event }) {
const minification_options = {
collapseWhitespace: true,
collapseInlineTagWhitespace: true,
removeComments: true,
removeComments: false,
minifyCSS: true,
minifyJS: true,
};
Expand Down
7 changes: 4 additions & 3 deletions front/src/lib/components/Meta.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

const {
metaTitle,
socialTitle,
metaImage,
metaDescription,
metaRobots,
Expand Down Expand Up @@ -65,7 +66,7 @@
},
]}
openGraph={{
title: metaTitle,
title: socialTitle || metaTitle,
description: metaDescription,
url: canonicalURL || false,
type: type,
Expand All @@ -80,8 +81,8 @@
site: '@dgrebb',
creator: '@dgrebb',
cardType: 'summary_large_image',
title: twitter?.title || pageMeta.title,
description: twitter?.description || pageMeta.description,
title: twitter?.title || socialTitle || pageMeta.title,
description: twitter?.description || pageMeta.metaDescription,
image: twitter?.image?.data?.attributes?.url || metaImage.url,
imageAlt:
twitter?.image?.data?.attributes?.alternativeText || metaImage.alt,
Expand Down
5 changes: 4 additions & 1 deletion front/src/routes/+error.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
error: $page.error.message,
data: $page.data,
});
console.log('🚀 ~ file: +error.svelte:11 ~ $page:', $page);
Sentry.captureMessage('Page Not Found', {
tags: {
status: 'NOT_FOUND',
Expand All @@ -23,6 +22,10 @@
});
</script>

<svelte:head>
<title>404!</title>
</svelte:head>

<PageTransition transitionKey={pathname}>
<section class="not-found">
<Flourish />
Expand Down
4 changes: 4 additions & 0 deletions front/src/routes/404/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
});
</script>

<svelte:head>
<title>404!</title>
</svelte:head>

<PageTransition transitionKey={pathname}>
<section class="not-found">
<Flourish />
Expand Down
8 changes: 5 additions & 3 deletions front/src/routes/post/[slug]/+page.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export async function load({ params: { slug }, route }) {
publishedAt,
type: 'article',
metaTitle: seo?.metaTitle || title,
titleTemplate: '%s | Writing | Dan Grebb',
socialTitle: `${seo?.metaTitle || title} « Writing « Dan Grebb`,
titleTemplate: '%s « Writing « Dan Grebb',
metaDescription:
seo?.metaDescription ||
summary ||
Expand All @@ -44,8 +45,9 @@ export async function load({ params: { slug }, route }) {
*/
pageMeta.metaImage = pageMeta?.metaImage?.data?.attributes ||
hero?.data?.attributes || {
url: 'https://s.dgrebb.com/img/default_banner_2a50e43220.png',
alternativeText: 'The Circuit of Life',
url: 'https://s.dgrebb.com/img/default_posts_0d52ddf1f2.webp',
alternativeText:
'A desk with various electronics, music instruments, audio equipment, and books laid out in an organized fashion.',
};

return {
Expand Down
9 changes: 4 additions & 5 deletions front/src/routes/posts/+page.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,16 @@ export async function load({ route }) {
var pageMeta = {
...page.seo,
type: 'website',
metaTitle: page?.seo?.metaTitle || page.headline,
metaTitle: 'Writing « Dan Grebb',
};

pageMeta.titleTemplate = '%s | Dan Grebb';

/**
* Isolates the `metaImage` object properties we care about
*/
pageMeta.metaImage = pageMeta?.metaImage?.data?.attributes || {
url: 'https://s.dgrebb.com/img/default_posts_meta_Image_02548488e7.jpg',
alternativeText: 'A writing desk surrounded by house plants',
url: 'https://s.dgrebb.com/img/default_posts_0d52ddf1f2.webp',
alternativeText:
'A desk with various electronics, music instruments, audio equipment, and books laid out in an organized fashion.',
};

return {
Expand Down
21 changes: 15 additions & 6 deletions front/src/routes/posts/category/[category]/+page.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,36 @@ export async function load({ params }) {
});
}

const { name, seo } = individualCategoryContent;
const {
name,
seo,
description: categoryDescription,
} = individualCategoryContent;

const pageMeta = {
...seo,
type: 'website',
metaTitle: seo?.metaTitle || name,
titleTemplate: '%s | Categories | Dan Grebb',
socialTitle: `${seo?.metaTitle || name} « Writing by Category « Dan Grebb`,
titleTemplate: `%s « Writing by Category « Dan Grebb`,
metaDescription:
seo?.metaDescription ||
individualCategoryContent?.description ||
`Here's a collection of posts about ${name}`,
categoryDescription !== null
? categoryDescription
: `Posts about "${name}"`,
};

console.log(
'🚀 ~ file: +page.server.js:51 ~ load ~ pageMeta:',
pageMeta.metaDescription
);
/**
* Isolates the `metaImage` object properties we care about
*/
pageMeta.metaImage = {
url:
pageMeta?.metaImage?.formats?.large?.url ||
categoryPageContent?.seo?.metaImage?.formats?.large?.url ||
'https://s.dgrebb.com/img/default_categories_34209a13ff.png',
'https://s.dgrebb.com/img/default_categories_ad8e01e054.webp',
alternativeText:
pageMeta?.metaImage?.alternativeText ||
categoryPageContent?.seo?.metaImage?.alternativeText ||
Expand Down
5 changes: 3 additions & 2 deletions front/src/routes/privacy/+page.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ export async function load({ params }) {
...seo,
type: 'website',
metaTitle: seo?.metaTitle || title,
titleTemplate: '%s | Dan Grebb',
socialTitle: `${seo?.metaTitle || title} « Dan Grebb`,
titleTemplate: '%s « Dan Grebb',
metaDescription: seo?.metaDescription || 'Privacy Practices at dgrebb.com',
};

/**
* Isolates the `metaImage` object properties we care about
*/
pageMeta.metaImage = pageMeta?.metaImage?.data?.attributes || {
url: 'https://s.dgrebb.com/img/default_privacy_meta_Image_c5581a5569.jpg',
url: 'https://s.dgrebb.com/img/default_privacy_963504effe.webp',
alternativeText: 'The Circuit of Life',
};
return {
Expand Down
2 changes: 1 addition & 1 deletion front/vite.local.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const sourceMapsUploadOptions = {
authToken: process.env.SENTRY_AUTH_TOKEN,
uploadSourceMaps: true,
telemetry: false,
debug: true,
debug: false,
org: 'dgrebb',
project: 'dgrebb',
include: ['build'],
Expand Down
Loading