-
Notifications
You must be signed in to change notification settings - Fork 365
Expand file tree
/
Copy pathBase.astro
More file actions
executable file
·182 lines (163 loc) · 4.72 KB
/
Base.astro
File metadata and controls
executable file
·182 lines (163 loc) · 4.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
---
import TwSizeIndicator from "@/components/TwSizeIndicator.astro";
import config from "@/config/config.json";
import theme from "@/config/theme.json";
import { plainify } from "@/lib/utils/textConverter";
import Footer from "@/partials/Footer.astro";
import Header from "@/partials/Header.astro";
import "@/styles/main.scss";
import { AstroFont } from "astro-font";
import { ViewTransitions } from "astro:transitions";
import SearchModal from "./helpers/SearchModal";
// font families
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;
meta_title?: string;
description?: string;
image?: string;
noindex?: boolean;
canonical?: string;
}
// distructure frontmatters
const { title, meta_title, description, image, noindex, canonical } =
Astro.props;
---
<!doctype html>
<html lang="en">
<head>
<!-- favicon -->
<link rel="shortcut icon" href={config.site.favicon} />
<!-- theme meta -->
<meta name="theme-name" content="astroplate" />
<meta name="msapplication-TileColor" content="#000000" />
<meta
name="theme-color"
media="(prefers-color-scheme: light)"
content="#fff"
/>
<meta
name="theme-color"
media="(prefers-color-scheme: dark)"
content="#000"
/>
<meta name="generator" content={Astro.generator} />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- google font css -->
<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 -->
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=5"
/>
<!-- title -->
<title>
{plainify(meta_title ? meta_title : title ? title : config.site.title)}
</title>
<!-- canonical url -->
{canonical && <link rel="canonical" href={canonical} item-prop="url" />}
<!-- noindex robots -->
{noindex && <meta name="robots" content="noindex,nofollow" />}
<!-- meta-description -->
<meta
name="description"
content={plainify(
description ? description : config.metadata.meta_description,
)}
/>
<ViewTransitions />
<!-- author from config.json -->
<meta name="author" content={config.metadata.meta_author} />
<!-- og-title -->
<meta
property="og:title"
content={plainify(
meta_title ? meta_title : title ? title : config.site.title,
)}
/>
<!-- og-description -->
<meta
property="og:description"
content={plainify(
description ? description : config.metadata.meta_description,
)}
/>
<meta property="og:type" content="website" />
<meta
property="og:url"
content={`${config.site.base_url}/${Astro.url.pathname.replace("/", "")}`}
/>
<!-- twitter-title -->
<meta
name="twitter:title"
content={plainify(
meta_title ? meta_title : title ? title : config.site.title,
)}
/>
<!-- twitter-description -->
<meta
name="twitter:description"
content={plainify(
description ? description : config.metadata.meta_description,
)}
/>
<!-- og-image -->
<meta
property="og:image"
content={`${config.site.base_url}${
image ? image : config.metadata.meta_image
}`}
/>
<!-- twitter-image -->
<meta
name="twitter:image"
content={`${config.site.base_url}${
image ? image : config.metadata.meta_image
}`}
/>
<meta name="twitter:card" content="summary_large_image" />
</head>
<body class="flex flex-col min-h-screen items-center [&>*]:w-full [&>footer]:mt-auto">
<TwSizeIndicator />
<Header />
<SearchModal client:load />
<main id="main-content">
<slot />
</main>
<Footer />
</body>
</html>