Let user add property to a frontmatter custom section
Opened this issue · 0 comments
Edo78 commented
To let user creating their metadata (maybe to use them with dataview or as they like) I can let create a frontmatter section and while rendering the template extracting that section and adding to a custom frontmatter property
Eg. the user made a template
---
date: <%= it.datetime.split(' ')[0] %>
year:: <%= new Date(Date.parse(it.datetime)).getYear() %>
---
lorem ipsum dolor sit amet
After rendering (presuming datetime
equals to 2019-01-25 15:45:56
I'll have
---
date: '2019-01-25'
year: '2019'
---
lorem ipsum dolor sit amet
then easily use the body as usual while the frontmatter will be included in the original frontmatter
eg.
---
koreader-sync:
uniqueId: 6df8a578d70600b70277474ee9062780
[...]
user_metadata:
date: '2019-01-25'
year: '2019'
---
and they can be accessed as koreader-sync.user_metadata.year