mirror of
https://github.com/tachiyomiorg/website.git
synced 2024-12-21 07:31:58 +01:00
Enable frontmatter og-theme support
Also allows changing from large to small og image
This commit is contained in:
parent
2969c46083
commit
58442aab3a
@ -8,6 +8,8 @@ const generateMeta = (context: TransformContext, hostname: string) => {
|
|||||||
|
|
||||||
head.push(["link", { rel: "canonical", href: url }]);
|
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:url", content: url }]);
|
||||||
head.push(["meta", { property: "og:type", content: pageData.frontmatter.type }]);
|
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:title", content: pageData.frontmatter.title }]);
|
||||||
@ -18,8 +20,17 @@ const generateMeta = (context: TransformContext, hostname: string) => {
|
|||||||
head.push(["meta", { name: "twitter:description", content: pageData.frontmatter.description }]);
|
head.push(["meta", { name: "twitter:description", content: pageData.frontmatter.description }]);
|
||||||
|
|
||||||
if (pageData.frontmatter.image) {
|
if (pageData.frontmatter.image) {
|
||||||
head.push(["meta", { property: "og:image", content: `${hostname}/${pageData.frontmatter.image}` }]);
|
head.push(["meta", { property: "og:image", content: `${hostname}/${pageData.frontmatter.image.replace(/^\//, "")}` }]);
|
||||||
head.push(["meta", { name: "twitter:image", content: `${hostname}/${pageData.frontmatter.image}` }]);
|
head.push(["meta", { name: "twitter:image", content: `${hostname}/${pageData.frontmatter.image.replace(/^\//, "")}` }]);
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
if (pageData.frontmatter.tag) {
|
||||||
|
@ -29,16 +29,9 @@ features:
|
|||||||
details: Describe Feature here.
|
details: Describe Feature here.
|
||||||
icon: <img src="https://mangadex.org/img/brand/mangadex-logo.svg">
|
icon: <img src="https://mangadex.org/img/brand/mangadex-logo.svg">
|
||||||
|
|
||||||
head:
|
theme: "#FD6684"
|
||||||
- - meta
|
image: /forks/forks_logo-neko.png
|
||||||
- property: og:image
|
imageSize: small
|
||||||
content: /forks/forks_logo-neko.png
|
|
||||||
- - meta
|
|
||||||
- name: theme-color
|
|
||||||
content: "#FD6684"
|
|
||||||
- - meta
|
|
||||||
- name: msapplication-TileColor
|
|
||||||
content: "#FD6684"
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<br><VPTeamMembers size="small" :members="members" />
|
<br><VPTeamMembers size="small" :members="members" />
|
||||||
|
@ -29,16 +29,9 @@ features:
|
|||||||
details: Describe Feature here.
|
details: Describe Feature here.
|
||||||
icon: <img src="https://tachiyomi-v3-gridsome.netlify.app/assets/forks_logo-az.png" height="32px" width="32px">
|
icon: <img src="https://tachiyomi-v3-gridsome.netlify.app/assets/forks_logo-az.png" height="32px" width="32px">
|
||||||
|
|
||||||
head:
|
theme: "#FFCC4D"
|
||||||
- - meta
|
image: /forks/forks_logo-az.png
|
||||||
- property: og:image
|
imageSize: small
|
||||||
content: /forks/forks_logo-az.png
|
|
||||||
- - meta
|
|
||||||
- name: theme-color
|
|
||||||
content: "#FFCC4D"
|
|
||||||
- - meta
|
|
||||||
- name: msapplication-TileColor
|
|
||||||
content: "#FFCC4D"
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<br><VPTeamMembers size="small" :members="members" />
|
<br><VPTeamMembers size="small" :members="members" />
|
||||||
|
@ -38,16 +38,9 @@ features:
|
|||||||
details: Describe Feature here.
|
details: Describe Feature here.
|
||||||
icon: 👑
|
icon: 👑
|
||||||
|
|
||||||
head:
|
theme: "#0952AF"
|
||||||
- - meta
|
image: /forks/forks_logo-j2k.png
|
||||||
- property: og:image
|
imageSize: small
|
||||||
content: /forks/forks_logo-j2k.png
|
|
||||||
- - meta
|
|
||||||
- name: theme-color
|
|
||||||
content: "#0952AF"
|
|
||||||
- - meta
|
|
||||||
- name: msapplication-TileColor
|
|
||||||
content: "#0952AF"
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<br><VPTeamMembers size="small" :members="members" />
|
<br><VPTeamMembers size="small" :members="members" />
|
||||||
|
@ -38,16 +38,9 @@ features:
|
|||||||
details: Describe Feature here.
|
details: Describe Feature here.
|
||||||
icon: 🐍
|
icon: 🐍
|
||||||
|
|
||||||
head:
|
theme: "#CE2828"
|
||||||
- - meta
|
image: /forks/forks_logo-sy.png
|
||||||
- property: og:image
|
imageSize: small
|
||||||
content: /forks/forks_logo-sy.png
|
|
||||||
- - meta
|
|
||||||
- name: theme-color
|
|
||||||
content: "#CE2828"
|
|
||||||
- - meta
|
|
||||||
- name: msapplication-TileColor
|
|
||||||
content: "#CE2828"
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<br><VPTeamMembers size="small" :members="members" />
|
<br><VPTeamMembers size="small" :members="members" />
|
||||||
|
Loading…
Reference in New Issue
Block a user