# Exposing more elements of \`config\` to template rendering

**URL:** <https://zola.discourse.group/t/exposing-more-elements-of-config-to-template-rendering/1564>\
**Category:** Feature requests\
**Created:** [December 10, 2022, 7:51pm UTC](https://zola.discourse.group/t/exposing-more-elements-of-config-to-template-rendering/1564 "2022-12-10T19:51:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidmreed](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/davidmreed/32/876_2.png) [@davidmreed](https://zola.discourse.group/u/davidmreed)\
**Post date:** [December 10, 2022, 7:51pm UTC](https://zola.discourse.group/t/exposing-more-elements-of-config-to-template-rendering/1564/1 "2022-12-10T19:51:54Z")

</div>

The `SerializedConfig` object that is provided during template rendering [does not include all of the elements of the source `Config` object](https://github.com/getzola/zola/blob/1dc768284c1ba1df2bd2835f306446e928a80c80/components/config/src/config/mod.rs#L308). In particular, an element that would be useful to a theme I’m working on is exposing the `markdown` configuration.

I’d use this to allow the theme’s base template to automatically include the syntax-highlighting CSS files, something like this:

```
{% if config.markdown.highlight_code and config.markdown.highlight_theme == "css" %}
<link rel="stylesheet" type="text/css" href="/syntax-theme-dark.css" media="(prefers-color-scheme: dark)" />
<link rel="stylesheet" type="text/css" href="/syntax-theme-light.css" media="(prefers-color-scheme: light)" />
{% endif %}

```

which makes Lighthouse happier than using CSS imports and should marginally improve performance.

There’s a workaround, for sure - the site using the theme can be allowed to insert this code using a block.

I’d be happy to work on this and open a PR if the project is open to it.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [December 12, 2022, 7:41pm UTC](https://zola.discourse.group/t/exposing-more-elements-of-config-to-template-rendering/1564/2 "2022-12-12T19:41:31Z")

</div>

That would be fine, let’s expose as little as needed though.
