retypeapp / retype

Retype is an ✨ ultra-high-performance✨ static site generator that builds a website based on simple text files.
https://retype.com
Other
1.06k stars 204 forks source link

Global authors #539

Open VeeBack opened 1 year ago

VeeBack commented 1 year ago

Make it possible to have a global list of authors in the project config file with their name, email etc, and then on each page you would only need to provide an email.

geoffreymcgill commented 1 year ago

Thanks for the suggestion.

There is a way to get something similar working using includes.

The first step is to create the file _includes/frank.md and use the following content:

  - name: Frank
    email: frank@example.com

Then add the include to the author config of your page using the syntax {{ include "frank" }}. The following sample.md file demonstrates:

---
author: 
{{ include "frank" }}
---
# Sample

Sample page.

If you revise the frank.md file and save, all pages where you included {{ include "frank" }} will also be automatically updated.

You can stack authors by just repeating the include for each author. For instance, the following sample demonstrates adding both Frank and Maria as authors:

---
author: 
{{ include "frank" }}
{{ include "maria" }}
---
# Sample

Sample page.

Just add _includes/maria.md with the new author details:

  - name: Maria
    email: maria@example.com

Hope this helps.