fix: og image

This commit is contained in:
OLIMINATOR 2023-01-07 14:25:24 +01:00
parent 13ac49f60d
commit 585d88db76
4 changed files with 5 additions and 16 deletions

View file

@ -1,17 +1,6 @@
--- ---
import { getImage } from '@astrojs/image'; import { getImage } from '@astrojs/image';
import { SITE, OPEN_GRAPH } from '../config'; import { SITE, OPEN_GRAPH } from '../config';
const defaultImage = OPEN_GRAPH.image.src
? (
await getImage({
src: OPEN_GRAPH.image.src,
alt: OPEN_GRAPH.image.alt,
width: 640,
height: 320,
})
).src
: '';
--- ---
<!-- Primary Meta Tags --> <!-- Primary Meta Tags -->
@ -25,7 +14,7 @@ const defaultImage = OPEN_GRAPH.image.src
<meta property="og:site_name" content={SITE.title} /> <meta property="og:site_name" content={SITE.title} />
<meta property="og:title" content={SITE.title} /> <meta property="og:title" content={SITE.title} />
<meta property="og:description" content={SITE.description} /> <meta property="og:description" content={SITE.description} />
<meta property="og:image" content={defaultImage} /> <meta property="og:image" content={OPEN_GRAPH.image.src} />
<meta property="og:image:alt" content={OPEN_GRAPH.image.alt} /> <meta property="og:image:alt" content={OPEN_GRAPH.image.alt} />
<!-- Twitter --> <!-- Twitter -->
@ -34,7 +23,7 @@ const defaultImage = OPEN_GRAPH.image.src
<meta property="twitter:url" content={SITE.url} /> <meta property="twitter:url" content={SITE.url} />
<meta property="twitter:title" content={SITE.title} /> <meta property="twitter:title" content={SITE.title} />
<meta property="twitter:description" content={SITE.description} /> <meta property="twitter:description" content={SITE.description} />
<meta property="twitter:image" content={defaultImage} /> <meta property="twitter:image" content={OPEN_GRAPH.image.src} />
<meta name="twitter:image:alt" content={OPEN_GRAPH.image.alt} /> <meta name="twitter:image:alt" content={OPEN_GRAPH.image.alt} />
<meta name="theme-color" content={SITE.themeColor} /> <meta name="theme-color" content={SITE.themeColor} />

View file

@ -7,7 +7,7 @@ export const SITE = {
export const OPEN_GRAPH = { export const OPEN_GRAPH = {
image: { image: {
src: '../src/assets/images/og-image.png', src: './src/assets/images/og_image.png',
alt: 'Odkazy text s tlačítkami', alt: 'Odkazy text s tlačítkami',
}, },
twitter: 'oliminator34', twitter: 'oliminator34',

View file

@ -9,7 +9,7 @@ import HeadSEO from '../components/HeadSEO.astro';
<HeadCommon /> <HeadCommon />
<HeadSEO /> <HeadSEO />
</head> </head>
<body class="bg-primaryDotted bg-primaryDottedSize font-alt3"> <body class="bg-primaryDotted bg-primaryDottedSize overflow-x-hidden">
<slot /> <slot />
</body> </body>
</html> </html>

View file

@ -11,7 +11,7 @@ import Item from '../components/Item.astro';
<Picture /> <Picture />
<Username /> <Username />
</header> </header>
<section class="mt-6 flex w-80 flex-col gap-y-6"> <section class="mt-6 flex w-72 md:w-80 flex-col gap-y-6">
<Item /> <Item />
</section> </section>
</main> </main>