Skip to content

Commit

Permalink
Fix og:url tags on gallery pages
Browse files Browse the repository at this point in the history
  • Loading branch information
stormwarning committed Dec 10, 2023
1 parent 1472d1b commit 277c5be
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion www/src/routes/photos/[slug]/+page.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const load = async ({ params }) => {
/** @todo Get optimal OG image height and include .height() */
post.coverImage = urlFor(post.coverImage)
.width(1200)
.height(630)
.format('jpg')
.url()

Expand All @@ -32,7 +33,7 @@ export const load = async ({ params }) => {
return image
})

return { post }
return { post, slug: params.slug }
}

throw error(404, 'Not found.')
Expand Down
2 changes: 1 addition & 1 deletion www/src/routes/photos/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Item from '../item.svelte'
export let data
</script>

<Item {data} />
<Item {data} slug={data.slug} />
6 changes: 6 additions & 0 deletions www/src/routes/photos/item.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import TextLede from '$lib/components/text-lede.svelte'
/** @type {'screen-shots' | undefined} */
export let collection = undefined
/** @type {string} */
export let slug
/** @type {import('./[slug]/$types').PageData} */
export let data
$: ({ post } = data)
Expand All @@ -27,6 +30,8 @@ $: ({
if (collection === 'screen-shots') fullTitle += ' — Screen Shots'
let url = ['https://tidaltheory.io/photos', collection, slug].join('/')
let isCarouselOpen = false
let initialIndex = 0
Expand All @@ -49,6 +54,7 @@ function handleCloseCarousel() {
<meta name="twitter:card" content="summary_large_card" />
<meta property="og:title" content="{fullTitle} — Tidal Theory" />
<meta property="og:description" content={ledeClean} />
<meta property="og:url" content="{url}/" />
<meta property="og:image" content={coverImage} />
</svelte:head>

Expand Down
3 changes: 2 additions & 1 deletion www/src/routes/photos/screen-shots/[slug]/+page.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const load = async ({ params }) => {
/** @todo Get optimal OG image height and include .height() */
post.coverImage = urlFor(post.coverImage)
.width(1200)
.height(630)
.format('jpg')
.url()

Expand All @@ -32,7 +33,7 @@ export const load = async ({ params }) => {
return image
})

return { post }
return { post, slug: params.slug }
}

throw error(404, 'Not found.')
Expand Down
2 changes: 1 addition & 1 deletion www/src/routes/photos/screen-shots/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Item from '../../item.svelte'
export let data
</script>

<Item {data} collection="screen-shots" />
<Item {data} collection="screen-shots" slug={data.slug} />

0 comments on commit 277c5be

Please sign in to comment.