diff options
-rw-r--r-- | src/content/dependencies/generateInterpageDotSwitcher.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/content/dependencies/generateInterpageDotSwitcher.js b/src/content/dependencies/generateInterpageDotSwitcher.js new file mode 100644 index 00000000..5a33444e --- /dev/null +++ b/src/content/dependencies/generateInterpageDotSwitcher.js @@ -0,0 +1,31 @@ +export default { + contentDependencies: ['generateDotSwitcherTemplate'], + extraDependencies: ['html', 'language'], + + relations: (relation) => ({ + template: + relation('generateDotSwitcherTemplate'), + }), + + slots: { + attributes: { + type: 'attributes', + mutable: false, + }, + + links: { + validate: v => v.strictArrayOf(v.isHTML), + }, + }, + + generate: (relations, slots) => + relations.template.slots({ + attributes: [ + {class: 'interpage'}, + slots.attributes, + ], + + // TODO: Do something to set a class on a link to the current page?? + options: slots.links, + }), +}; |