somewhat fix meta

h
This commit is contained in:
taskylizard 2023-10-31 20:42:36 +05:30
parent d3d5858b13
commit 2b65bc9332
No known key found for this signature in database
GPG Key ID: 5CABA3D642DDC497
7 changed files with 42 additions and 47 deletions

2
.github/replace.py vendored
View File

@ -6,7 +6,7 @@ def replaces_for_beginners_guide(text):
text = re.sub('\[TOC\]\n', '', text, flags=re.MULTILINE) text = re.sub('\[TOC\]\n', '', text, flags=re.MULTILINE)
text = re.sub('\*\*Table of Contents\*\*\n\[TOC2\]\n', '', text, flags=re.MULTILINE) text = re.sub('\*\*Table of Contents\*\*\n\[TOC2\]\n', '', text, flags=re.MULTILINE)
text = re.sub('# -> \*\*\*Beginners Guide to Piracy\*\*\* <-\n', '', text, flags=re.MULTILINE) text = re.sub('# -> \*\*\*Beginners Guide to Piracy\*\*\* <-\n', '', text, flags=re.MULTILINE)
text = re.sub(r"!!!note\s(.+?)\n", r":::tip\n\1\n:::\n", text, flags=re.MULTILINE) text = re.sub(r"!!!note\s(.+?)\n", r":::info\n\1\n:::\n", text, flags=re.MULTILINE)
text = re.sub(r"!!!info\s(.+?)\n", r":::info\n\1\n:::\n", text, flags=re.MULTILINE) text = re.sub(r"!!!info\s(.+?)\n", r":::info\n\1\n:::\n", text, flags=re.MULTILINE)
text = re.sub(r"!!!warning\s(.+?)\n", r":::warning\n\1\n:::\n", text, flags=re.MULTILINE) text = re.sub(r"!!!warning\s(.+?)\n", r":::warning\n\1\n:::\n", text, flags=re.MULTILINE)
text = re.sub(r">\s(.+?)\n", r"> \1\n\n", text, flags=re.MULTILINE) text = re.sub(r">\s(.+?)\n", r"> \1\n\n", text, flags=re.MULTILINE)

3
.github/script.sh vendored
View File

@ -1,5 +1,6 @@
python .github/add-headers.py
for file in *; do for file in *; do
[[ -f "$file" ]] && mv "$file" "${file,,}" 2>/dev/null [[ -f "$file" ]] && mv "$file" "${file,,}" 2>/dev/null
done done
python .github/replace.py python .github/replace.py
# python .github/add-headers.py

View File

@ -10,7 +10,7 @@ export default withPwa(
defineConfig({ defineConfig({
title: "FMHY", title: "FMHY",
description: meta.description, description: meta.description,
titleTemplate: ":title | FreeMediaHeckYeah", titleTemplate: ":title • freemediaheckyeah",
lang: "en-US", lang: "en-US",
lastUpdated: true, lastUpdated: true,
cleanUrls: true, cleanUrls: true,
@ -21,27 +21,37 @@ export default withPwa(
hostname: meta.hostname, hostname: meta.hostname,
}, },
head: [ head: [
["meta", { name: "theme-color", content: "#7bc5e4" }], ["meta", { name: "theme-color", content: "#7bc5e4" }],
["meta", { name: "og:type", content: "website" }], ["meta", { name: "og:type", content: "website" }],
["meta", { name: "og:locale", content: "en" }], ["meta", { name: "og:locale", content: "en" }],
["meta", { property: "og:type", content: "website" }], ["link", { rel: "icon", href: "/test.png" }],
["meta", { property: "og:title", content: meta.name }], // PWA
["link", { rel: "icon", href: "/fmhy.ico", sizes: "any" }],
["link", { rel: "icon", href: "/test.png", type: "image/svg+xml" }], ["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: "alternate icon", href: "/test.png" }],
["link", { rel: "apple-touch-icon", href: "/fmhy.png", sizes: "192x192" }], ["link", { rel: "mask-icon", href: "/test.png", color: "#7bc5e4" }],
["meta", { name: "apple-mobile-web-app-status-bar-style", content: "black-translucent" }], // prettier-ignore
["meta", { name: "keywords", content: meta.keywords.join(" ") }], ["meta", { name: "keywords", content: meta.keywords.join(" ") }],
["meta", { name: "twitter:description", content: meta.description }], ["link", { rel: "apple-touch-icon", href: "/test.png", sizes: "192x192" }],
["meta", { name: "twitter:title", content: meta.name }],
["meta", { name: "twitter:card", content: "summary_large_image" }], // ["meta", { name: "theme-color", content: "#7bc5e4" }],
["meta", { name: "twitter:site", content: meta.hostname }], // ["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), transformHead: async (context) => generateMeta(context, meta.hostname),
vite: { vite: {
plugins: [ plugins: [
UnoCSS({ UnoCSS({

View File

@ -10,13 +10,9 @@ export function generateMeta(context: TransformContext, hostname: string) {
head.push(["meta", { property: "og:url", content: url }]); head.push(["meta", { property: "og:url", content: url }]);
head.push(["meta", { name: "twitter: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: "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) { if (pageData.frontmatter.description) {
head.push([ head.push([
"meta", "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) { if (pageData.lastUpdated && pageData.frontmatter.lastUpdated !== false) {
head.push([ head.push([
"meta", "meta",

View File

@ -40,7 +40,7 @@ export default defineLoader({
const obj = Object.fromEntries( const obj = Object.fromEntries(
[...guides.entries()].map((entry, index) => [index.toString(), entry]), [...guides.entries()].map((entry, index) => [index.toString(), entry]),
); );
await writeFile("./guides.json",JSON.stringify(obj, null, 4), "") await writeFile("./guides.json", JSON.stringify(obj, null, 4), "utf-8");
return await readFile("./guides.json", { encoding: "utf-8"}) return JSON.parse(await readFile("./guides.json", { encoding: "utf-8" })) as Data;
}, },
}); });

View File

@ -64,7 +64,6 @@ export const pwa = {
globPatterns: ["**/*.{css,js,html,svg,png,ico,txt,woff2,json}"], globPatterns: ["**/*.{css,js,html,svg,png,ico,txt,woff2,json}"],
globIgnores: ["**/404.html"], globIgnores: ["**/404.html"],
navigateFallback: null, navigateFallback: null,
runtimeCaching: [ runtimeCaching: [
{ {
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i, urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,

View File

@ -1,13 +1,13 @@
--- ---
title: Guides title: Guides
--- ---
<script setup> <!-- <script setup> -->
import { data } from "./.vitepress/loaders/guides.data"; <!-- import { data } from "./.vitepress/loaders/guides.data"; -->
</script> <!-- </script> -->
<!---->
<template> <!-- <template> -->
<h2>Guides</h2> <!-- <h2>Guides</h2> -->
<br /> <!-- <br /> -->
<ul> <!-- <ul> -->
</ul> <!-- </ul> -->
</template> <!-- </template> -->