haecker-felix/hebbot

Make the template more configurable

thibaultamartin opened this issue · 3 comments

It would be very helpful to be able to set:

  • How section are rendered (variable available: {{section.emoji}}, {{section.title}})
  • How projects are rendered (variables available: {{project.emoji}}, {{project.title}}, {{project.website}}, {{project.description}})

It would typically allow people to have sections that are h2 title in markdown and not h1 title by declaring them as ## {{section.title}} and to change how project titles are rendered, e.g. as ### {{project.title}} ([link]({{project.website}}))

It looks like the simplest solution is to add a section_title_template and a project_title_template in the config.toml, but it can also be confusing to get a config file with bits of templating, and a separate template.md file.

Another solution to keep code fairly clean would be to have three distinct template files: report_template.md, section_template.md and project_template.md.

report_template.md would look like:

---
title: "#{{weeknumber}} This Week in X"
author: {{author}}
date: {{today}}
tags: [{{projects}}]
categories: ["weekly-update"]
draft: false
---

Update on what happened across the X project in the week from {{timespan}}.

{{sections}}

# That’s all for this week!

See you next week!

section_template.md would look like:

# {{section.title}} {{section.emoji}}

{{projects}}

And finally project_template.md would look like:

### {{project.title}} [↗]({{project.website}})

{{project.description}}

{{news}}

+1 for this - e.g. I just patched my fork to use h2 for section headers at the request of our content editor - would be nice not to have to :)

Another solution to keep code fairly clean would be to have three distinct template files: report_template.md, section_template.md and project_template.md.

works for me 👍