« get me outta code hell

content: transformContent: support [[site/media/root:path]] - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/linkPathFromRoot.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-08-08 21:01:15 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-08-08 21:01:15 -0300
commit42a81b7172c856ad611431ef7d7b468d5b1ffbfd (patch)
treeab343a6c25699b41c41ec369fa7a5ca69e793fe3 /src/content/dependencies/linkPathFromRoot.js
parent6645e6e8e0e58c59d1660767181bb32efbf7930a (diff)
content: transformContent: support [[site/media/root:path]]
Diffstat (limited to 'src/content/dependencies/linkPathFromRoot.js')
-rw-r--r--src/content/dependencies/linkPathFromRoot.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/content/dependencies/linkPathFromRoot.js b/src/content/dependencies/linkPathFromRoot.js
new file mode 100644
index 0000000..dab3ac1
--- /dev/null
+++ b/src/content/dependencies/linkPathFromRoot.js
@@ -0,0 +1,13 @@
+export default {
+  contentDependencies: ['linkTemplate'],
+
+  relations: (relation) =>
+    ({link: relation('linkTemplate')}),
+
+  data: (path) =>
+    ({path}),
+
+  generate: (data, relations) =>
+    relations.link
+      .slot('path', ['shared.path', data.path]),
+};