Skip to content

Commit

Permalink
#113 Fix OG image and url
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpadberg committed Feb 4, 2025
1 parent a3be1b1 commit bb48d92
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
1 change: 1 addition & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import icon from 'astro-icon'
// https://astro.build/config
export default defineConfig({
compressHTML: true,
site: 'https://accessible-astro.netlify.app',
integrations: [
mdx(),
icon(),
Expand Down
2 changes: 1 addition & 1 deletion src/components/SiteMeta.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let subtitle = 'Accessible Astro Starter'
<meta property="og:description" content={description} />
<meta property="og:type" content="website" />
<meta property="og:url" content={url} />
<meta property="og:image" content={Astro.site ? `${Astro.site}${image}` : image} />
<meta property="og:image" content={`${Astro.site}${image}`} />

<!-- twitter card -->

Expand Down
14 changes: 3 additions & 11 deletions src/layouts/DefaultLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import Footer from '../components/Footer.astro'
const {
title = 'Astro',
description = 'A starter project with accessibility features using Astro static site builder. Contains accessible landmarks, skip links, a dark mode color scheme, better focus outline and keyboard menu navigation.',
url,
image = '/social-preview-image.png',
url = Astro.site,
image = 'social-preview-image.png',
author = 'Mark Teekman',
} = Astro.props
---
Expand All @@ -23,15 +23,7 @@ const {
<!-- favicon -->
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />

<SiteMeta
title={title}
description={description.substring(0, 100)}
url={Astro.site
? `${Astro.site}/${title.toLowerCase().replaceAll(' ', '-')}`
: `https://accessible-astro.dev/${title.toLowerCase().replaceAll(' ', '-')}`}
image={image}
author={author}
/>
<SiteMeta title={title} description={description.substring(0, 100)} url={url} image={image} author={author} />
</head>
<body>
<Header />
Expand Down

0 comments on commit bb48d92

Please # to comment.