Move site
to a prop instead of directly importing from within the component. (#803)
This commit is contained in:
parent
debbc18708
commit
7b600d597b
2 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
|||
---
|
||||
import { site } from '../config.ts';
|
||||
const { content = {}, canonicalURL } = Astro.props;
|
||||
export interface Props {
|
||||
content: any,
|
||||
site: any,
|
||||
canonicalURL: URL | string,
|
||||
};
|
||||
const { content = {}, site, canonicalURL } = Astro.props;
|
||||
const formattedContentTitle = content.title ? `${content.title} 🚀 ${site.title}` : site.title;
|
||||
const imageSrc = content?.image?.src ?? site.image.src;
|
||||
const canonicalImageSrc = new URL(imageSrc, Astro.site);
|
||||
|
|
|
@ -23,7 +23,7 @@ if (currentPage) {
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>{content.title ? `${content.title} 🚀 ${site.title}` : site.title}</title>
|
||||
<MetaData {content} canonicalURL={Astro.request.canonicalURL}/>
|
||||
<MetaData {content} {site} canonicalURL={Astro.request.canonicalURL}/>
|
||||
|
||||
<!-- This is intentionally inlined to avoid FOUC -->
|
||||
<script>
|
||||
|
|
Loading…
Reference in a new issue