Add opengraph tags to pages
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 59s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 59s
This commit is contained in:
parent
e8e6e12450
commit
a47141efba
2 changed files with 14 additions and 6 deletions
|
@ -1,6 +1,3 @@
|
||||||
import { SearchPlugin } from "vitepress-plugin-search";
|
|
||||||
import { defineConfig } from "vitepress";
|
|
||||||
import wordCounting from "word-counting";
|
|
||||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||||
|
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
@ -49,6 +46,20 @@ export default {
|
||||||
['link', { rel: 'me', href: 'https://twitter.com/ThePaperPilot' }],
|
['link', { rel: 'me', href: 'https://twitter.com/ThePaperPilot' }],
|
||||||
['meta', { name: 'og:description', content: 'The Paper Pilot\'s Digital Garden' }]
|
['meta', { name: 'og:description', content: 'The Paper Pilot\'s Digital Garden' }]
|
||||||
],
|
],
|
||||||
|
async transformHead(context) {
|
||||||
|
context.head.push(["meta", { name: "og:title", content: context.pageData.title }]);
|
||||||
|
context.head.push(["meta", { name: "og:description", content: context.pageData.description }]);
|
||||||
|
context.head.push(["meta", { name: "og:image", content: "https://www.thepaperpilot.org/paperpilot.png" }]);
|
||||||
|
context.head.push(["meta", { name: "og:site_name", content: context.siteData.description }]);
|
||||||
|
if (context.pageData.relativePath.startsWith("garden")) {
|
||||||
|
context.head.push(["meta", { name: "og:type", content: "article" }]);
|
||||||
|
context.head.push(["meta", { name: "article:author", content: "https://www.thepaperpilot.org/about" }]);
|
||||||
|
const published = context.content.match(/<time class='dt-published' datetime='[^']+'>([0-9-]+)<\/time>/)[1];
|
||||||
|
const updated = context.content.match(/<time class='dt-updated' datetime='[^']+'>([0-9-]+)<\/time>/)[1];
|
||||||
|
context.head.push(["meta", { name: "article:published_time", content: published }]);
|
||||||
|
context.head.push(["meta", { name: "article:modified_time", content: updated }]);
|
||||||
|
}
|
||||||
|
},
|
||||||
lastUpdated: false,
|
lastUpdated: false,
|
||||||
cleanUrls: 'with-subfolders',
|
cleanUrls: 'with-subfolders',
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
|
|
||||||
const util = require('node:util');
|
const util = require('node:util');
|
||||||
const exec = util.promisify(require('node:child_process').exec);
|
const exec = util.promisify(require('node:child_process').exec);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue