more opengraph metadata
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Michael Zhang 2023-09-01 07:59:21 -05:00
parent 0ef4b692e4
commit 4a03a76348
4 changed files with 36 additions and 4 deletions

View file

@ -6,6 +6,7 @@ import { astroImageTools } from "astro-imagetools";
import { remarkReadingTime } from "./plugin/remark-reading-time"; import { remarkReadingTime } from "./plugin/remark-reading-time";
import emoji from "remark-emoji"; import emoji from "remark-emoji";
import remarkMermaid from "astro-diagram/remark-mermaid"; import remarkMermaid from "astro-diagram/remark-mermaid";
import remarkDescription from "astro-remark-description";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
@ -13,6 +14,11 @@ export default defineConfig({
integrations: [mdx(), sitemap(), astroImageTools], integrations: [mdx(), sitemap(), astroImageTools],
markdown: { markdown: {
syntaxHighlight: false, syntaxHighlight: false,
remarkPlugins: [remarkReadingTime, remarkMermaid, emoji], remarkPlugins: [
remarkReadingTime,
remarkMermaid,
emoji,
[remarkDescription, { name: "excerpt" }],
],
}, },
}); });

22
package-lock.json generated
View file

@ -14,6 +14,7 @@
"astro": "^3.0.3", "astro": "^3.0.3",
"astro-diagram": "^0.7.0", "astro-diagram": "^0.7.0",
"astro-imagetools": "^0.9.0", "astro-imagetools": "^0.9.0",
"astro-remark-description": "^1.0.1",
"fork-awesome": "^1.2.0", "fork-awesome": "^1.2.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"mdast-util-to-string": "^4.0.0", "mdast-util-to-string": "^4.0.0",
@ -1870,6 +1871,27 @@
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
} }
}, },
"node_modules/astro-remark-description": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/astro-remark-description/-/astro-remark-description-1.0.1.tgz",
"integrity": "sha512-ZbpK6pxlgMNfxeTaDgM081WW8toKn5G/j94TgYr8B6RwaCR8Os31Gp7ahdsLhXbXqhXcUi65Ehz8x2O83h8apw==",
"dependencies": {
"mdast-util-to-string": "^3.1.0",
"unist-util-visit": "^4.1.1"
}
},
"node_modules/astro-remark-description/node_modules/mdast-util-to-string": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz",
"integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==",
"dependencies": {
"@types/mdast": "^3.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/b4a": { "node_modules/b4a": {
"version": "1.6.4", "version": "1.6.4",
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.4.tgz",

View file

@ -16,6 +16,7 @@
"astro": "^3.0.3", "astro": "^3.0.3",
"astro-diagram": "^0.7.0", "astro-diagram": "^0.7.0",
"astro-imagetools": "^0.9.0", "astro-imagetools": "^0.9.0",
"astro-remark-description": "^1.0.1",
"fork-awesome": "^1.2.0", "fork-awesome": "^1.2.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"mdast-util-to-string": "^4.0.0", "mdast-util-to-string": "^4.0.0",

View file

@ -31,12 +31,15 @@ const datestamp = post.data.date.toLocaleDateString(undefined, {
--- ---
<BaseLayout> <BaseLayout>
<!-- <meta slot="head" name="description" content="{{ .Summary }}" /> -->
<meta slot="head" property="og:title" content={post.data.title} /> <meta slot="head" property="og:title" content={post.data.title} />
<!-- <meta slot="head" property="og:url" content="{{ .Permalink }}" /> --> <meta slot="head" property="og:url" content={Astro.url} />
<!-- <meta slot="head" property="og:description" content="{{ .Summary }}" /> --> <meta slot="head" property="og:description" content={remarkPluginFrontmatter.excerpt} />
<meta slot="head" property="og:type" content="article" /> <meta slot="head" property="og:type" content="article" />
<meta slot="head" property="og:locale" content="en_US" />
{heroImage && <meta slot="head" property="og:image" content={heroImage.src} />} {heroImage && <meta slot="head" property="og:image" content={heroImage.src} />}
{heroAlt && <meta slot="head" property="og:image:alt" content={heroAlt} />}
<meta slot="head" property="description" content={remarkPluginFrontmatter.excerpt} />
<meta slot="head" property="article:published_time" content={datestamp} /> <meta slot="head" property="article:published_time" content={datestamp} />
<div class="post-container"> <div class="post-container">