mirror of
https://github.com/10h30/astroplate.git
synced 2026-06-05 15:08:00 +09:00
Update Base.astro
This commit is contained in:
+34
-9
@@ -1,4 +1,5 @@
|
||||
---
|
||||
import { AstroFont } from "astro-font";
|
||||
import TwSizeIndicator from "@/components/TwSizeIndicator.astro";
|
||||
import config from "@/config/config.json";
|
||||
import theme from "@/config/theme.json";
|
||||
@@ -13,6 +14,18 @@ import SearchModal from "./helpers/SearchModal";
|
||||
const pf = theme.fonts.font_family.primary;
|
||||
const sf = theme.fonts.font_family.secondary;
|
||||
|
||||
let fontPrimary, fontSecondary;
|
||||
if (theme.fonts.font_family.primary) {
|
||||
fontPrimary = theme.fonts.font_family.primary
|
||||
.replace(/\+/g, " ")
|
||||
.replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, "");
|
||||
}
|
||||
if (theme.fonts.font_family.secondary) {
|
||||
fontSecondary = theme.fonts.font_family.secondary
|
||||
.replace(/\+/g, " ")
|
||||
.replace(/:[ital,]*[ital@]*[wght@]*[0-9,;]+/gi, "");
|
||||
}
|
||||
|
||||
// types for frontmatters
|
||||
export interface Props {
|
||||
title?: string;
|
||||
@@ -50,15 +63,27 @@ const { title, meta_title, description, image, noindex, canonical } =
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<!-- google font css -->
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href={`https://fonts.googleapis.com/css2?family=${pf}${
|
||||
sf ? "&family=" + sf : ""
|
||||
}&display=swap`}
|
||||
rel="preload"
|
||||
as="style"
|
||||
onload="this.rel='stylesheet'"
|
||||
<AstroFont
|
||||
config={[
|
||||
{
|
||||
src: [],
|
||||
preload: false,
|
||||
display: "swap",
|
||||
name: fontPrimary,
|
||||
fallback: "sans-serif",
|
||||
cssVariable: "font-primary",
|
||||
googleFontsURL: `https://fonts.googleapis.com/css2?family=${pf}&display=swap`,
|
||||
},
|
||||
{
|
||||
src: [],
|
||||
preload: false,
|
||||
display: "swap",
|
||||
name: fontSecondary,
|
||||
fallback: "sans-serif",
|
||||
cssVariable: "font-secondary",
|
||||
googleFontsURL: `https://fonts.googleapis.com/css2?family=${sf}&display=swap`,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
<!-- responsive meta -->
|
||||
|
||||
Reference in New Issue
Block a user