support alternative file formats for content, besides '.lr' (was: support Markdown with YAML Front Matter)
See original GitHub issueThere is a common, widely used data format for static site generators known as “Markdown with YAML Front Matter”. The contents.lr format is almost the same, with some key differences. If Lektor supported Markdown with YAML Front Matter, then all sorts of other tools like editors, syntax highlighters, translation tools, etc will automatically support the Lektor files. They could be called contents.md, for example.
This is a file from a Lektor site:
section: localization
---
section_id: localization
---
color: primary
---
_template: layout.html
---
title: Localization
---
subtitle: We want Tor to work for everyone in the world, which means our software must be translated into a lot of languages.
---
cta: Help us translate
---
key: 4
---
html: localization.html
---
body:
##Localization is how we reach a global community.
In order for Tor to work for everyone, it needs to speak everyone's languages.
Our volunteer translation team works hard to make this a reality, and we can always use more help.
Our current translation priorities are translating [Tor Browser](https://torpat.ch/locales), Tor Browser documentation, and the [Tor Project website](https://torpat.ch/tpo-locales), but there are many other documents that we could use help translating as well.
In Markdown with YAML Front Matter, it would look like this:
---
section: localization
section_id: localization
color: primary
_template: layout.html
title: Localization
subtitle: We want Tor to work for everyone in the world, which means our software must be translated into a lot of languages.
cta: Help us translate
key: 4
html: localization.html
---
##Localization is how we reach a global community.
In order for Tor to work for everyone, it needs to speak everyone's languages.
Our volunteer translation team works hard to make this a reality, and we can always use more help.
Our current translation priorities are translating [Tor Browser](https://torpat.ch/locales), Tor Browser documentation, and the [Tor Project website](https://torpat.ch/tpo-locales), but there are many other documents that we could use help translating as well.
Here are some docs on the format:
- https://jekyllrb.com/docs/front-matter/
- https://gohugo.io/content-management/front-matter/
- https://assemble.io/docs/YAML-front-matter.html
- https://www.gatsbyjs.org/docs/adding-markdown-pages/#frontmatter-for-metadata-in-markdown-files
And here are many libraries which support this format:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:17 (12 by maintainers)
Top Results From Across the Web
Support YAML front matter in Markdown files #207 - GitHub
YAML is often prepended to markdown files to provide structured metadata. This "front matter" pattern is commonly implemented by static site ...
Read more >Front Matter - Hugo
Hugo supports four formats for front matter, each with their own identifying tokens. TOML: identified by opening and closing +++ . YAML: identified...
Read more >formatting a markdown file scrambles the yaml frontmatter.
Here is a sample file before formatting. Before formatting. Here is the same file after formatting. (by pressing Alt + Ctrl + L...
Read more >YAML front matter - Assemble.io
YFM is an optional section of valid YAML that is placed at the top of a page and is used for maintaining metadata...
Read more >Front Matter | Jekyll • Simple, blog-aware, static sites
Any file that contains a YAML front matter block will be processed by Jekyll as a special file. The front matter must be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Amen.
Seriously though, having a standardized entry point seems like a good refactor to me, and it might be inroads into implementing #477 and ingesting bulk content.
It’s also worth repeating I think that people can set their IDEs to a Markdown mode and immediately get syntax highlighting for their markdown fields in a
.lr
file. I’d bet that’s really the driver for a lot of people reading this. Go ahead and do this now if you’re one of those people. 🙂@nixjdm I think I want to give this a crack. If you have some pointers, they’re welcome.
The point of editing them has also come up (#745). Tools that deal with md+fm obviously mess the lr up.