« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateSocialEmbed.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateSocialEmbed.js')
-rw-r--r--src/content/dependencies/generateSocialEmbed.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/content/dependencies/generateSocialEmbed.js b/src/content/dependencies/generateSocialEmbed.js
index 85a0f4d3..513ea518 100644
--- a/src/content/dependencies/generateSocialEmbed.js
+++ b/src/content/dependencies/generateSocialEmbed.js
@@ -1,5 +1,5 @@
 export default {
-  extraDependencies: ['html', 'language', 'wikiData'],
+  extraDependencies: ['absoluteTo', 'html', 'language', 'wikiData'],
 
   sprawl({wikiInfo}) {
     return {
@@ -23,10 +23,10 @@ export default {
 
     headingContent: {type: 'string'},
     headingLink: {type: 'string'},
-    imagePath: {type: 'string'},
+    imagePath: {validate: v => v.strictArrayOf(v.isString)},
   },
 
-  generate(data, slots, {html, language}) {
+  generate(data, slots, {absoluteTo, html, language}) {
     switch (slots.mode) {
       case 'html':
         return html.tags([
@@ -40,7 +40,10 @@ export default {
             }),
 
           slots.imagePath &&
-            html.tag('meta', {property: 'og:image', content: slots.imagePath}),
+            html.tag('meta', {
+              property: 'og:image',
+              content: absoluteTo(...slots.imagePath),
+            }),
         ]);
 
       case 'json':