fix: properly load ubuntu font
This commit is contained in:
parent
3955e219e6
commit
245ad3a625
3 changed files with 68 additions and 68 deletions
|
|
@ -6,9 +6,9 @@ import ubuntuRegularWoff2 from "@fontsource/ubuntu/files/ubuntu-latin-400-normal
|
||||||
import ubuntuBoldWoff2 from "@fontsource/ubuntu/files/ubuntu-latin-700-normal.woff2?url";
|
import ubuntuBoldWoff2 from "@fontsource/ubuntu/files/ubuntu-latin-700-normal.woff2?url";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
image?: string;
|
image?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
||||||
|
|
@ -24,18 +24,18 @@ const { title, description, image = "/blog-placeholder-1.jpg" } = Astro.props;
|
||||||
|
|
||||||
<!-- Font preloads, keep them even if it throws a warning for not using them due to the system providing them -->
|
<!-- Font preloads, keep them even if it throws a warning for not using them due to the system providing them -->
|
||||||
<link
|
<link
|
||||||
rel="preload"
|
rel="preload"
|
||||||
href={ubuntuRegularWoff2}
|
href={ubuntuRegularWoff2}
|
||||||
as="font"
|
as="font"
|
||||||
type="font/woff2"
|
type="font/woff2"
|
||||||
crossorigin
|
crossorigin
|
||||||
/>
|
/>
|
||||||
<link
|
<link
|
||||||
rel="preload"
|
rel="preload"
|
||||||
href={ubuntuBoldWoff2}
|
href={ubuntuBoldWoff2}
|
||||||
as="font"
|
as="font"
|
||||||
type="font/woff2"
|
type="font/woff2"
|
||||||
crossorigin
|
crossorigin
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Canonical URL -->
|
<!-- Canonical URL -->
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,12 @@ import Header from "../components/Header.astro";
|
||||||
import Footer from "../components/Footer.astro";
|
import Footer from "../components/Footer.astro";
|
||||||
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
|
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
|
||||||
import DarkModeToggle from "../components/DarkModeToggle.astro";
|
import DarkModeToggle from "../components/DarkModeToggle.astro";
|
||||||
|
import "@fontsource/ubuntu";
|
||||||
|
import "@fontsource/ubuntu/700.css";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title = SITE_TITLE, description = SITE_DESCRIPTION } = Astro.props;
|
const { title = SITE_TITLE, description = SITE_DESCRIPTION } = Astro.props;
|
||||||
|
|
@ -15,61 +17,59 @@ const { title = SITE_TITLE, description = SITE_DESCRIPTION } = Astro.props;
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<BaseHead title={title} description={description} />
|
<BaseHead title={title} description={description} />
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
// On page load or when changing themes, best to add inline in `head` to avoid FOUC
|
||||||
if (
|
if (
|
||||||
localStorage.getItem("color-theme") === "dark" ||
|
localStorage.getItem("color-theme") === "dark" ||
|
||||||
(!("color-theme" in localStorage) &&
|
(!("color-theme" in localStorage) &&
|
||||||
window.matchMedia("(prefers-color-scheme: dark)").matches)
|
window.matchMedia("(prefers-color-scheme: dark)").matches)
|
||||||
) {
|
) {
|
||||||
document.documentElement.classList.add("dark");
|
document.documentElement.classList.add("dark");
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.classList.remove("dark");
|
document.documentElement.classList.remove("dark");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-white dark:bg-gray-900 text-black dark:text-white">
|
<body class="bg-white dark:bg-gray-900 text-black dark:text-white">
|
||||||
<!-- Mobile layout -->
|
<!-- Mobile layout -->
|
||||||
<div class="lg:hidden flex flex-col min-h-screen p-4">
|
<div class="lg:hidden flex flex-col min-h-screen p-4">
|
||||||
<div class="flex justify-between items-center mb-4">
|
<div class="flex justify-between items-center mb-4">
|
||||||
<h2 class="font-bold text-lg">
|
<h2 class="font-bold text-lg">
|
||||||
<a href="/">{SITE_TITLE}</a>
|
<a href="/">{SITE_TITLE}</a>
|
||||||
</h2>
|
</h2>
|
||||||
<DarkModeToggle />
|
<DarkModeToggle />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Header />
|
<Header />
|
||||||
|
|
||||||
<main class="flex-grow">
|
<main class="flex-grow">
|
||||||
<slot />
|
<slot />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Desktop layout -->
|
<!-- Desktop layout -->
|
||||||
<div
|
<div
|
||||||
class="hidden lg:grid grid-cols-[150px_1fr_60px] gap-4 min-h-screen p-4"
|
class="hidden lg:grid grid-cols-[150px_1fr_60px] gap-4 min-h-screen p-4"
|
||||||
>
|
>
|
||||||
<div class="flex items-start">
|
<div class="flex items-start">
|
||||||
<h2 class="font-bold text-xl mt-3">
|
<h2 class="font-bold text-xl mt-3">
|
||||||
<a href="/">{SITE_TITLE}</a>
|
<a href="/">{SITE_TITLE}</a>
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Header />
|
<Header />
|
||||||
<main
|
<main class="w-full lg:w-[768px] max-w-[calc(100%-2em)] mx-auto p-2">
|
||||||
class="w-full lg:w-[768px] max-w-[calc(100%-2em)] mx-auto p-2"
|
<slot />
|
||||||
>
|
</main>
|
||||||
<slot />
|
</div>
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex justify-end">
|
<div class="flex justify-end">
|
||||||
<DarkModeToggle />
|
<DarkModeToggle />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: "Ubuntu";
|
font-family: "Ubuntu", sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue