mirror of
https://github.com/tachiyomiorg/website.git
synced 2024-12-21 07:31:58 +01:00
Fixes to head/meta generation
This commit is contained in:
parent
ca560632b8
commit
c56a5184cd
@ -26,7 +26,6 @@ const head: HeadConfig[] = [
|
||||
],
|
||||
["meta", { property: "og:locale", content: "en_US" }],
|
||||
["meta", { property: "og:type", content: "website" }],
|
||||
["meta", { property: "og:image", content: "/img/logo.png" }],
|
||||
];
|
||||
|
||||
export default head;
|
||||
|
@ -7,18 +7,23 @@ const generateMeta = (context: TransformContext, hostname: string) => {
|
||||
const url = `${hostname}/${pageData.relativePath.replace(/((^|\/)index)?\.md$/, "$2")}`;
|
||||
|
||||
head.push(["link", { rel: "canonical", href: url }]);
|
||||
|
||||
head.push(["meta", { name: "theme-color", content: pageData.frontmatter.theme }]);
|
||||
|
||||
head.push(["meta", { property: "og:url", content: url }]);
|
||||
head.push(["meta", { property: "og:type", content: pageData.frontmatter.type }]);
|
||||
head.push(["meta", { property: "og:title", content: pageData.frontmatter.title }]);
|
||||
head.push(["meta", { property: "og:description", content: pageData.frontmatter.description }]);
|
||||
|
||||
head.push(["meta", { name: "twitter:url", content: url }]);
|
||||
head.push(["meta", { name: "twitter:title", content: pageData.frontmatter.title }]);
|
||||
head.push(["meta", { name: "twitter:description", content: pageData.frontmatter.description }]);
|
||||
|
||||
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.title) {
|
||||
head.push(["meta", { property: "og:title", content: pageData.frontmatter.title }]);
|
||||
head.push(["meta", { name: "twitter:title", content: pageData.frontmatter.title }]);
|
||||
}
|
||||
if (pageData.frontmatter.description) {
|
||||
head.push(["meta", { property: "og:description", content: pageData.frontmatter.description }]);
|
||||
head.push(["meta", { name: "twitter:description", content: pageData.frontmatter.description }]);
|
||||
}
|
||||
if (pageData.frontmatter.image) {
|
||||
head.push([
|
||||
"meta",
|
||||
@ -28,25 +33,16 @@ const generateMeta = (context: TransformContext, hostname: string) => {
|
||||
"meta",
|
||||
{ name: "twitter:image", content: `${hostname}/${pageData.frontmatter.image.replace(/^\//, "")}` },
|
||||
]);
|
||||
} else {
|
||||
head.push(["meta", { property: "og:image", content: `${hostname}/img/logo.png` }]);
|
||||
head.push(["meta", { name: "twitter:image", content: `${hostname}/img/logo.png` }]);
|
||||
}
|
||||
|
||||
switch (pageData.frontmatter.imageSize) {
|
||||
case "small":
|
||||
head.push(["meta", { name: "twitter:card", content: "summary" }]);
|
||||
break;
|
||||
case "large":
|
||||
head.push(["meta", { name: "twitter:card", content: "summary_large_image" }]);
|
||||
break;
|
||||
}
|
||||
|
||||
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",
|
||||
|
Loading…
Reference in New Issue
Block a user