lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.75k stars 74 forks source link

Merged key in the layouts #618

Closed oscarotero closed 3 weeks ago

oscarotero commented 3 weeks ago

Enter your suggestions in details:

From discord conversation

mergedKeys allows to configure the merging strategy of some variables. This behavior should be applied also to layouts.

Use case:

I have a layout that needs a CSS file, and depends on other layout

---
layout: layouts/base.vto
css_file: /styles1.css
---

<main>
  {{ content }}
</main>

The other layout has also a css_file:

---
css_file: /styles-base.css
---
<html>
<head>
  {{ for style of css_file }}
    <link rel="stylesheet" href="{{ style }}">
  {{ /for }}
</head>
<body>
{{ content }}
</body>
</html>

The idea is to use the stringArray mode for css_file variable. It works with pages and _data files but not in layouts.