mirror of
https://github.com/fmhy/edit.git
synced 2026-02-19 09:41:17 +11:00
somewhat fix meta
h
This commit is contained in:
parent
d3d5858b13
commit
2b65bc9332
7 changed files with 42 additions and 47 deletions
|
|
@ -10,7 +10,7 @@ export default withPwa(
|
|||
defineConfig({
|
||||
title: "FMHY",
|
||||
description: meta.description,
|
||||
titleTemplate: ":title | FreeMediaHeckYeah",
|
||||
titleTemplate: ":title • freemediaheckyeah",
|
||||
lang: "en-US",
|
||||
lastUpdated: true,
|
||||
cleanUrls: true,
|
||||
|
|
@ -21,27 +21,37 @@ export default withPwa(
|
|||
hostname: meta.hostname,
|
||||
},
|
||||
head: [
|
||||
|
||||
["meta", { name: "theme-color", content: "#7bc5e4" }],
|
||||
["meta", { name: "og:type", content: "website" }],
|
||||
["meta", { name: "og:locale", content: "en" }],
|
||||
["meta", { property: "og:type", content: "website" }],
|
||||
["meta", { property: "og:title", content: meta.name }],
|
||||
["link", { rel: "icon", href: "/fmhy.ico", sizes: "any" }],
|
||||
["link", { rel: "icon", href: "/test.png" }],
|
||||
// PWA
|
||||
["link", { rel: "icon", href: "/test.png", type: "image/svg+xml" }],
|
||||
["link", { rel: "mask-icon", href: "/test.png", color: "#7bc5e4" }],
|
||||
// pwa
|
||||
["link", { rel: "alternate icon", href: "/test.png" }],
|
||||
["link", { rel: "apple-touch-icon", href: "/fmhy.png", sizes: "192x192" }],
|
||||
["meta", { name: "apple-mobile-web-app-status-bar-style", content: "black-translucent" }],
|
||||
["link", { rel: "mask-icon", href: "/test.png", color: "#7bc5e4" }],
|
||||
// prettier-ignore
|
||||
["meta", { name: "keywords", content: meta.keywords.join(" ") }],
|
||||
["meta", { name: "twitter:description", content: meta.description }],
|
||||
["meta", { name: "twitter:title", content: meta.name }],
|
||||
["meta", { name: "twitter:card", content: "summary_large_image" }],
|
||||
["meta", { name: "twitter:site", content: meta.hostname }],
|
||||
["link", { rel: "apple-touch-icon", href: "/test.png", sizes: "192x192" }],
|
||||
|
||||
// ["meta", { name: "theme-color", content: "#7bc5e4" }],
|
||||
// ["meta", { name: "og:type", content: "website" }],
|
||||
// ["meta", { name: "og:locale", content: "en" }],
|
||||
// ["meta", { property: "og:type", content: "website" }],
|
||||
// ["meta", { property: "og:title", content: meta.name }],
|
||||
// ["link", { rel: "icon", href: "/fmhy.ico", sizes: "any" }],
|
||||
// ["link", { rel: "icon", href: "/test.png", type: "image/svg+xml" }],
|
||||
// ["link", { rel: "mask-icon", href: "/test.png", color: "#7bc5e4" }],
|
||||
// // pwa
|
||||
// ["link", { rel: "alternate icon", href: "/test.png" }],
|
||||
// ["link", { rel: "apple-touch-icon", href: "/fmhy.png", sizes: "192x192" }],
|
||||
// ["meta", { name: "apple-mobile-web-app-status-bar-style", content: "black-translucent" }],
|
||||
// ["meta", { name: "keywords", content: meta.keywords.join(" ") }],
|
||||
// ["meta", { name: "twitter:description", content: meta.description }],
|
||||
// ["meta", { name: "twitter:title", content: meta.name }],
|
||||
// ["meta", { name: "twitter:card", content: "summary_large_image" }],
|
||||
// ["meta", { name: "twitter:site", content: meta.hostname }],
|
||||
],
|
||||
transformHead: async (context) => generateMeta(context, meta.hostname),
|
||||
|
||||
vite: {
|
||||
plugins: [
|
||||
UnoCSS({
|
||||
|
|
|
|||
|
|
@ -10,13 +10,9 @@ export function generateMeta(context: TransformContext, hostname: string) {
|
|||
head.push(["meta", { property: "og:url", content: url }]);
|
||||
head.push(["meta", { name: "twitter:url", content: url }]);
|
||||
head.push(["meta", { name: "twitter:card", content: "summary_large_image" }]);
|
||||
head.push(["meta", { name: "theme-color", content: "#7bc5e4" }]);
|
||||
head.push(["meta", { property: "og:type", content: "website" }]);
|
||||
|
||||
if (pageData.frontmatter.theme) {
|
||||
head.push(["meta", { name: "theme-color", content: pageData.frontmatter.theme }]);
|
||||
}
|
||||
if (pageData.frontmatter.type) {
|
||||
head.push(["meta", { property: "og:type", content: pageData.frontmatter.type }]);
|
||||
}
|
||||
if (pageData.frontmatter.description) {
|
||||
head.push([
|
||||
"meta",
|
||||
|
|
@ -52,18 +48,7 @@ export function generateMeta(context: TransformContext, hostname: string) {
|
|||
},
|
||||
]);
|
||||
}
|
||||
if (pageData.frontmatter.tag) {
|
||||
head.push(["meta", { property: "article:tag", content: pageData.frontmatter.tag }]);
|
||||
}
|
||||
if (pageData.frontmatter.date) {
|
||||
head.push([
|
||||
"meta",
|
||||
{
|
||||
property: "article:published_time",
|
||||
content: pageData.frontmatter.date,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
if (pageData.lastUpdated && pageData.frontmatter.lastUpdated !== false) {
|
||||
head.push([
|
||||
"meta",
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export default defineLoader({
|
|||
const obj = Object.fromEntries(
|
||||
[...guides.entries()].map((entry, index) => [index.toString(), entry]),
|
||||
);
|
||||
await writeFile("./guides.json",JSON.stringify(obj, null, 4), "")
|
||||
return await readFile("./guides.json", { encoding: "utf-8"})
|
||||
await writeFile("./guides.json", JSON.stringify(obj, null, 4), "utf-8");
|
||||
return JSON.parse(await readFile("./guides.json", { encoding: "utf-8" })) as Data;
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ export const pwa = {
|
|||
globPatterns: ["**/*.{css,js,html,svg,png,ico,txt,woff2,json}"],
|
||||
globIgnores: ["**/404.html"],
|
||||
navigateFallback: null,
|
||||
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue