refactor: hoist script only if title is defined
This commit is contained in:
parent
cb17156ed7
commit
f1b6661d6e
1 changed files with 15 additions and 5 deletions
|
@ -8,16 +8,13 @@ const defaultDescription =
|
||||||
|
|
||||||
const defaultTitle = "Ayo Ayco | Software Engineer, Web Developer, Consultant";
|
const defaultTitle = "Ayo Ayco | Software Engineer, Web Developer, Consultant";
|
||||||
|
|
||||||
let {
|
let { title, description = defaultDescription } = Astro.props;
|
||||||
title = "Ayo Ayco | Software Engineer, Web Developer, Consultant",
|
|
||||||
description = defaultDescription,
|
|
||||||
} = Astro.props;
|
|
||||||
|
|
||||||
const baseURL = "https://ayo.ayco.io";
|
const baseURL = "https://ayo.ayco.io";
|
||||||
---
|
---
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>{title ? title + ` | ${defaultTitle}` : defaultTitle}</title>
|
<title>{title || defaultTitle}</title>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
|
@ -43,4 +40,17 @@ const baseURL = "https://ayo.ayco.io";
|
||||||
<meta property="og:image" content="/ayo.png" />
|
<meta property="og:image" content="/ayo.png" />
|
||||||
|
|
||||||
<link rel="shortcut icon" type="image/png" href="/favicon.ico" />
|
<link rel="shortcut icon" type="image/png" href="/favicon.ico" />
|
||||||
|
|
||||||
|
{
|
||||||
|
title ? (
|
||||||
|
<script>
|
||||||
|
const title = document.title; if(title){" "}
|
||||||
|
{
|
||||||
|
(document.title = `${title} | Ayo Ayco | Software Engineer, Web Developer, Consultant`)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
) : (
|
||||||
|
<meta />
|
||||||
|
)
|
||||||
|
}
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in a new issue