Fix all the SEO on all pages and not overwrite layout unless I want to.

This commit is contained in:
Bradley Shellnut 2023-11-08 15:30:56 -08:00
parent a6ccd20224
commit c0eadcf458
8 changed files with 162 additions and 43 deletions

View file

@ -2,10 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="description"
content="My name is Bradley Shellnut and I'm a Full Stack Software Engineer."
/>
<link rel="icon" href="%sveltekit.assets%/b_shell_nut_favicon.gif" />
<meta name="viewport" content="width=device-width" />
<script>

View file

@ -4,6 +4,7 @@
import 'iconify-icon';
import { browser } from "$app/environment";
import { navigating, page } from "$app/stores";
import { PUBLIC_SITE_URL } from '$env/static/public';
import "nprogress/nprogress.css";
import '$root/styles/styles.pcss';
import Header from '$lib/components/header/index.svelte';
@ -17,6 +18,7 @@
});
const dev = process.env.NODE_ENV !== 'production';
const siteUrl = PUBLIC_SITE_URL || 'https://bradleyshellnut.com/';
$: {
if (browser && $navigating) {
@ -28,21 +30,12 @@
$: metaTags = {
titleTemplate: '%s | Bradley Shellnut',
openGraph: {
type: 'website',
locale: 'en_US',
images: [
{
url: `${$page.data.baseUrl}b_shell_nut_favicon.gif`,
alt: 'Bradley Shellnut Website Logo'
}
]
},
twitter: {
card: 'summary_large_image',
image: `${$page.data.baseUrl}b_shell_nut_favicon.gif`,
imageAlt: 'Bradley Shellnut Website Logo'
},
additionalMetaTags: [
{
property: 'theme-color',
content: '#272727'
}
],
...$page.data.metaTagsChild
}
</script>

View file

@ -1,23 +1,28 @@
import type { MetaTagsProps } from 'svelte-meta-tags';
import type { PageServerLoad } from './lib/$types';
import { fetchBandcampAlbums } from '$root/lib/util/fetchBandcampAlbums';
import { PUBLIC_SITE_URL } from '$env/static/public';
import type { PageServerLoad } from './$types';
import { fetchBandcampAlbums } from '$lib/util/fetchBandcampAlbums';
export const load: PageServerLoad = async ({ fetch, setHeaders, url }) => {
const baseUrl = new URL(url.origin).href;
const baseUrl = new URL(url.origin).href || PUBLIC_SITE_URL || 'https://bradleyshellnut.com';
const currentPageUrl = new URL(url.pathname, url.origin).href;
const metaTags: MetaTagsProps = Object.freeze({
title: 'Home',
description: "My name is Bradley Shellnut and I'm a Full Stack Software Engineer.",
openGraph: {
title: 'Home',
description: "My name is Bradley Shellnut and I'm a Full Stack Software Engineer.",
url: new URL(url.pathname, url.origin).href,
url: currentPageUrl,
siteName: 'Bradley Shellnut Personal Website',
type: 'website',
locale: 'en_US',
images: [
{
url: `${baseUrl}b_shell_nut_favicon.gif`,
alt: 'Bradley Shellnut Website Logo'
alt: 'Bradley Shellnut Website Logo',
width: 512,
height: 512
}
]
},
@ -28,7 +33,7 @@ export const load: PageServerLoad = async ({ fetch, setHeaders, url }) => {
image: `${baseUrl}b_shell_nut_favicon.gif`,
imageAlt: 'Bradley Shellnut Website Logo'
},
url: new URL(url.pathname, url.origin).href
url: currentPageUrl
});
const albums = async () => await fetchBandcampAlbums();
@ -43,5 +48,4 @@ export const load: PageServerLoad = async ({ fetch, setHeaders, url }) => {
albums: albums(),
articlesData: (await articles()).json()
};
};
// <link rel="icon" type="image/gif" href="/b_shell_nut_favicon.gif" />;
};

View file

@ -1,17 +1,39 @@
export const prerender = true;
import type { MetaTagsProps } from 'svelte-meta-tags';
import { PUBLIC_SITE_URL } from '$env/static/public';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url }) => {
const baseUrl = new URL(url.origin).href || PUBLIC_SITE_URL || 'https://bradleyshellnut.com';
const currentPageUrl = new URL(url.pathname, url.origin).href;
const metaTags: MetaTagsProps = Object.freeze({
title: 'About',
description: 'About Bradley Shellnut',
openGraph: {
title: 'About',
description: 'About Bradley Shellnut',
url: new URL(url.pathname, url.origin).href,
}
url: currentPageUrl,
siteName: 'Bradley Shellnut Personal Website',
type: 'website',
locale: 'en_US',
images: [
{
url: `${baseUrl}b_shell_nut_favicon.gif`,
alt: 'Bradley Shellnut Website Logo',
width: 512,
height: 512
}
]
},
twitter: {
title: 'About',
description: 'About page',
card: 'summary_large_image',
image: `${baseUrl}b_shell_nut_favicon.gif`,
imageAlt: 'Bradley Shellnut Website Logo'
},
url: currentPageUrl
});
return {

View file

@ -1,6 +1,7 @@
import { error } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
import { WALLABAG_MAX_PAGES } from '$env/static/private';
import { PUBLIC_SITE_URL } from '$env/static/public';
import type { Article } from '$lib/types/article';
export type ArticlePageLoad = {
@ -12,7 +13,7 @@ export type ArticlePageLoad = {
cacheControl: string;
};
export const load: PageServerLoad = async ({ fetch, params, setHeaders }) => {
export const load: PageServerLoad = async ({ fetch, params, setHeaders, url }) => {
const { page } = params;
if (+page > +WALLABAG_MAX_PAGES) {
throw error(404, {
@ -32,11 +33,45 @@ export const load: PageServerLoad = async ({ fetch, params, setHeaders }) => {
'cache-control': 'max-age=43200' // 12 hours
});
}
const baseUrl = new URL(url.origin).href || PUBLIC_SITE_URL || 'https://bradleyshellnut.com';
const currentPageUrl = new URL(url.pathname, url.origin).href;
const metaTags: MetaTagsProps = Object.freeze({
title: 'Favorite Articles',
description: 'My favorite articles',
openGraph: {
title: 'Facorite Articles',
description: 'My favorite articles',
url: currentPageUrl,
siteName: 'Bradley Shellnut Personal Website',
type: 'website',
locale: 'en_US',
images: [
{
url: `${baseUrl}b_shell_nut_favicon.gif`,
alt: 'Bradley Shellnut Website Logo',
width: 512,
height: 512
}
]
},
twitter: {
title: 'Favorite Articles',
description: 'My favorite articles',
card: 'summary_large_image',
image: `${baseUrl}b_shell_nut_favicon.gif`,
imageAlt: 'Bradley Shellnut Website Logo'
},
url: currentPageUrl
});
return {
articles,
currentPage,
totalPages,
limit,
totalArticles
totalArticles,
metaTagsChild: metaTags
};
};

View file

@ -1,17 +1,40 @@
export const prerender = true;
import type { MetaTagsProps } from 'svelte-meta-tags';
import { PUBLIC_SITE_URL } from '$env/static/public';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ url }) => {
const baseUrl = new URL(url.origin).href || PUBLIC_SITE_URL || 'https://bradleyshellnut.com';
const currentPageUrl = new URL(url.pathname, url.origin).href;
const metaTags: MetaTagsProps = Object.freeze({
title: 'Portfolio',
description: 'Bradley Shellnut\s Portfolio',
description: "Bradley Shellnut's Portfolio",
openGraph: {
title: 'Portfolio',
description: 'Bradley Shellnut\s Portfolio',
url: new URL(url.pathname, url.origin).href
}
description: "Bradley Shellnut's Portfolio",
url: currentPageUrl,
siteName: 'Bradley Shellnut Personal Website',
type: 'website',
locale: 'en_US',
images: [
{
url: `${baseUrl}b_shell_nut_favicon.gif`,
alt: 'Bradley Shellnut Website Logo',
width: 512,
height: 512
}
]
},
twitter: {
title: 'Portfolio',
description: "Bradley Shellnut's Portfolio",
card: 'summary_large_image',
image: `${baseUrl}b_shell_nut_favicon.gif`,
imageAlt: 'Bradley Shellnut Website Logo'
},
url: currentPageUrl
});
return {

View file

@ -1,17 +1,40 @@
export const prerender = true;
import type { MetaTagsProps } from 'svelte-meta-tags';
import { PUBLIC_SITE_URL } from '$env/static/public';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url }) => {
const baseUrl = new URL(url.origin).href || PUBLIC_SITE_URL || 'https://bradleyshellnut.com';
const currentPageUrl = new URL(url.pathname, url.origin).href;
const metaTags: MetaTagsProps = Object.freeze({
title: 'Privacy Blog',
description: 'My thoughts on personal internet privacy.',
openGraph: {
title: 'Privacy Blog',
description: 'My thoughts on personal internet privacy.',
url: new URL(url.pathname, url.origin).href
}
url: new URL(url.pathname, url.origin).href,
siteName: 'Bradley Shellnut Personal Website',
type: 'website',
locale: 'en_US',
images: [
{
url: `${baseUrl}b_shell_nut_favicon.gif`,
alt: 'Bradley Shellnut Website Logo',
width: 512,
height: 512
}
]
},
twitter: {
title: 'Privacy Blog',
description: 'My thoughts on personal internet privacy.',
card: 'summary_large_image',
image: `${baseUrl}b_shell_nut_favicon.gif`,
imageAlt: 'Bradley Shellnut Website Logo'
},
url: currentPageUrl
});
return {

View file

@ -1,17 +1,40 @@
export const prerender = true;
import type { MetaTagsProps } from 'svelte-meta-tags';
import { PUBLIC_SITE_URL } from '$env/static/public';
import type { PageLoad } from './$types';
export const load: PageLoad = async ({ url }) => {
const baseUrl = new URL(url.origin).href || PUBLIC_SITE_URL || 'https://bradleyshellnut.com';
const currentPageUrl = new URL(url.pathname, url.origin).href;
const metaTags: MetaTagsProps = Object.freeze({
title: 'Portfolio',
description: 'Bradley Shellnuts Portfolio',
title: '/Uses',
description: 'What I use!',
openGraph: {
title: 'Portfolio',
description: 'Bradley Shellnuts Portfolio',
url: new URL(url.pathname, url.origin).href
}
title: '/Uses',
description: 'What I use!',
url: new URL(url.pathname, url.origin).href,
siteName: 'Bradley Shellnut Personal Website',
type: 'website',
locale: 'en_US',
images: [
{
url: `${baseUrl}b_shell_nut_favicon.gif`,
alt: 'Bradley Shellnut Website Logo',
width: 512,
height: 512
}
]
},
twitter: {
title: '/Uses',
description: "What I use!",
card: 'summary_large_image',
image: `${baseUrl}b_shell_nut_favicon.gif`,
imageAlt: 'Bradley Shellnut Website Logo'
},
url: currentPageUrl
});
return {