From e4d2740a7c649246072e94067f99cda0829133aa Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 14 Jun 2025 18:56:50 -0300 Subject: content: generateContentContentHeading --- .../dependencies/generateContentContentHeading.js | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/content/dependencies/generateContentContentHeading.js (limited to 'src/content/dependencies/generateContentContentHeading.js') diff --git a/src/content/dependencies/generateContentContentHeading.js b/src/content/dependencies/generateContentContentHeading.js new file mode 100644 index 00000000..35bb91e9 --- /dev/null +++ b/src/content/dependencies/generateContentContentHeading.js @@ -0,0 +1,39 @@ +export default { + contentDependencies: ['generateContentHeading'], + extraDependencies: ['html', 'language'], + + relations: (relation, _thing) => ({ + contentHeading: + relation('generateContentHeading'), + }), + + data: (thing) => ({ + name: + thing.name, + }), + + slots: { + attributes: { + type: 'attributes', + mutable: false, + }, + + string: { + type: 'string', + }, + }, + + generate: (data, relations, slots, {html, language}) => + relations.contentHeading.slots({ + attributes: slots.attributes, + + title: + language.$(slots.string, { + thing: + html.tag('i', data.name), + }), + + stickyTitle: + language.$(slots.string, 'sticky'), + }), +} -- cgit 1.3.0-6-gf8a5