« get me outta code hell

content: generateAlbumGalleryPage: secondary nav on gallery page - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/linkAlbumDynamically.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-06 18:38:31 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-06 18:39:53 -0300
commit7cca97b865b7d9e299a7e1e6be9947a0fc0fb9c4 (patch)
tree4819896fd2460069c29f465e1297a489f8df9c49 /src/content/dependencies/linkAlbumDynamically.js
parentd7dcbbfe67ab7e8728da3f0503a6b1a20e9e2664 (diff)
content: generateAlbumGalleryPage: secondary nav on gallery page
Diffstat (limited to 'src/content/dependencies/linkAlbumDynamically.js')
-rw-r--r--src/content/dependencies/linkAlbumDynamically.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/content/dependencies/linkAlbumDynamically.js b/src/content/dependencies/linkAlbumDynamically.js
new file mode 100644
index 00000000..3adc64df
--- /dev/null
+++ b/src/content/dependencies/linkAlbumDynamically.js
@@ -0,0 +1,14 @@
+export default {
+  contentDependencies: ['linkAlbumGallery', 'linkAlbum'],
+  extraDependencies: ['pagePath'],
+
+  relations: (relation, album) => ({
+    galleryLink: relation('linkAlbumGallery', album),
+    infoLink: relation('linkAlbum', album),
+  }),
+
+  generate: (relations, {pagePath}) =>
+    (pagePath[0] === 'albumGallery'
+      ? relations.galleryLink
+      : relations.infoLink),
+};