Skip to content

Commit 5e42bd9

Browse files
committed
#3414 webpage: add twitter meta tags
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent 44a6ee8 commit 5e42bd9

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

webpage/src/.vuepress/config.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,28 +248,44 @@ export default defineUserConfig({
248248
tasklist: true,
249249
}),
250250
// SEO plugin - https://ecosystem.vuejs.press/plugins/seo/seo/
251+
// Doc: https://github.com/vuepress/ecosystem/blob/main/docs/plugins/seo/seo/config.md
251252
seoPlugin({
252253
hostname: "https://www.qownnotes.org",
253254
canonical: "https://www.qownnotes.org",
254255
author: {
255256
name: "Patrizio Bekerle",
256257
twitter: "PatrizioBekerle",
257258
},
258-
ogp: (ogp, page) => ({
259-
...ogp,
260-
"og:image": page.frontmatter.image
261-
? page.frontmatter.image.startsWith("http")
262-
? page.frontmatter.image
263-
: `https://www.qownnotes.org${page.frontmatter.image}`
264-
: "https://www.qownnotes.org/screenshots/screenshot.png",
265-
}),
259+
ogp: (ogp, page) => {
260+
// Helper function to get the image URL
261+
const getImageUrl = () => {
262+
return page.frontmatter.image
263+
? page.frontmatter.image.startsWith("http")
264+
? page.frontmatter.image
265+
: `https://www.qownnotes.org${page.frontmatter.image}`
266+
: "https://www.qownnotes.org/screenshots/screenshot.png";
267+
};
268+
269+
const imageUrl = getImageUrl();
270+
271+
return {
272+
...ogp,
273+
"og:image": imageUrl,
274+
"twitter:card": "summary_large_image",
275+
"twitter:title": page.title,
276+
"twitter:description": page.frontmatter.description || "",
277+
"twitter:image": imageUrl,
278+
"twitter:creator": "@PatrizioBekerle",
279+
};
280+
},
266281
}),
267282
// Sitemap plugin - https://ecosystem.vuejs.press/plugins/seo/sitemap/
268283
sitemapPlugin({
269284
hostname: "https://www.qownnotes.org",
270285
excludeUrls: ["/404.html"],
271286
}),
272287
// Feed plugin - https://ecosystem.vuejs.press/plugins/blog/feed/
288+
// Doc: https://github.com/vuepress/ecosystem/blob/main/docs/plugins/blog/feed/config.md
273289
feedPlugin({
274290
hostname: "https://www.qownnotes.org",
275291
rss: true,
@@ -303,10 +319,6 @@ export default defineUserConfig({
303319
"meta",
304320
{ name: "apple-mobile-web-app-status-bar-style", content: "black" },
305321
],
306-
[
307-
"meta",
308-
{ name: "viewport", content: "width=device-width, initial-scale=1.0" },
309-
],
310322
[
311323
"link",
312324
{

0 commit comments

Comments
 (0)