tajmone / PBCodeArcProto

PB CodeArchiv Rebirth Indexer Prototype
4 stars 0 forks source link

Using YAML in READMEs #6

Open tajmone opened 6 years ago

tajmone commented 6 years ago

Now I've added the meta.yaml file in "/_assets/" which contains commonly shared template metadata/vars as:

This file allows separation between the template and fixed contents like Header's title and subtitle, so they can be tweaked without having to edit pandoc's HTML5 template.

These vars will be used for every page. But any section can override these variables by adding a YAML header to the README.md file.

For example, see the Gadget category page, where the header-title has been overriden with a custom value by adding at the beginning of README.md file:

---
header-title: OVERRIDEN BY YAML HEADER IN README
---

# Gadget Category

GitHub supports YAML headers in markdown files, and in the WebUI document preview the YAML variables are formatted in a special way, as you can see at this link:

... YAML vars are rendered as tables:

key
value

... which is pretty cool as far as previewing READMEs on GitHub website goes.

Of course, handling variables in YAML headers is very practical and allows to fine-tune some aspects of the template on a per-category base without the limitations of auto-generated values.

The downside is that many markdown editors don't handle well YAML headings, so editing the README.md files might become problematic in some editors (and often break HTML previews, live or otherwise).

I wanted to ask you what you think about this. Strictly speaking, we don't need to use YAML headers to handle the document appearance, but having them would improve Search-Engines Optimization as it would allow to define custom values for description and keywords — this would affect not only how search engines index the various categories, but also how they are shown to the user in the results page.

Personally, I think that SEO is an important point (after all, the GitHub Pages website will be indexed, and some people might discover the project via Googling). This would allow to add the right keywords for each category and customize the description that will appear in Google search results. As far as local usage of the project goes, none of this really matters, of course.

Besides, there are Markdown editors that support YAML headers in markdown docs without breaking things (I use Sublime Text, and don't have problems).

But if you (or the other maintainers) use a specific editor for the project, and it doesn't handle YAML headers, then YAML headers might introduce some complications in the project's maintainance.

tajmone commented 6 years ago

One further consideration: deciding if we're going to use or not YAML headers in READMEs is a crucial decision at this point because it affects auto-generated pandoc variables.

If we're going to use auto-generated vars for the <title>, this means that the template var will have to calculated in the PB code and passed to pandoc via CLI options. Variables defined via CLI options can't be overriden by YAML headers because options have a higher priority over in-document defined vars.

Of course, we could use YAML headers just for the description and keywords vars, and let the app handle the category title automatically. This is fine, but this would be the right time to discuss it and decide a course of action regarding this — there might be some other pros and cons to consider in each approach.

SicroAtGit commented 6 years ago

That's a very good idea.

I didn't know about YAML before, so I had to research what it is. I'm learning some new things from you.

Until now I had no special editor for markdown files. Now I have taken a look at the different Markdown editors under Linux and have decided to use the slim program "Remarkable", which also has no problems with YAML within Markdown.

I think it should only be possible to change the description and keywords within the README.md file via YAML. "header-title" should always be "PureBasic-CodeArchive-Rebirth" and "header-subtitle" should always be "This is a collection of useful codes from the purebasic forums and other sources".

tajmone commented 6 years ago

I think it should only be possible to change the description and keywords within the README.md file via YAML. "header-title" should always be "PureBasic-CodeArchive-Rebirth" and "header-subtitle" should always be "This is a collection of useful codes from the purebasic forums and other sources".

The nature of YAML is that is allows to chain multiple YAML blocks in the input stream, so it's really more up to our own rules how we use it, rather than restricting it.

The file _asstes/meta.yaml contains the default definitions (including the Header title and subtitle). Unless a README file explicitly overrides the values in that file, they prevail. Of course, we'll be restricting the YAML headers in README files just to handle category-specific values.

The true reason/need for the _asstes/meta.yaml is just to allow changing default values without touching the pandoc template (which is just for the sake of separating each component).

YAML headers are cool, the only pity is that many markdown editor don't support it well.

tajmone commented 6 years ago

I've changed the metadata default for the header, according to your guidelines — just slightly shorted, and capitalization changes:

PureBasic CodeArchiv Rebirth
A collection of useful codes from the PureBasic forums and other sources
SicroAtGit commented 6 years ago

PureBasic CodeArchiv Rebirth

I had this spelling before the new building of the repository, but when I noticed that nowhere "archiv" is written in English texts, but always "archive", I adapted it. Now I don't know what's correct.

tajmone commented 6 years ago

I didn't even notice the missing "e", I just copied and pasted the string from the repo.

True, "archiv" is an unusual spelling, but I've got to associate it with the project during time. It sounds OK to me, and being the proper name of the project you can spell it as you like.

For one thing, the odd spelling should make it easier to find it in search engines like Google — all the keywords "pure", "basic", "code", "archive" and "rebirth" are very generic keywords, and Google will try to see "PureBasic" as a mispelling of "pure"+"basic" and pollute results. Usually you get a lot of unrelated results with any search because of these reasons (there is also a programming lang called "Pure", to add to the confusion).

Also the two words "CodeArchiv" being written as one should make for better search matches. If spelled "Archive", then Google will be more likely to see it as a typo of missing space and opt for searching "Code" + "Archive".

I remember that trying to find anything on Google for the "Io" lang was extremely difficult because of the name being a too short and generic keyword; eventually Google 's algorithms managed to fine tune the searches when it "understands" that you're looking up for a programming lang, but on the SEO side, trying to rise a website whose name are simple keywords is always an upstream battle.

But these are just side considerations regarding SEO, which shouldn't really be determinant here since the project already had its name in place. Maybe we should stick to the issue of "Archiv" being a mispelling of "Archive" (or being seen as one, anyhow).

Personally, I always thought it was intentional, as a way to make it clear it was a proper name of the project — just like people might spell "code" with a "K" ("Kode") in similar contexts, and so on.

How was the original website spelled out?

SicroAtGit commented 6 years ago

When I took over the repository from GPI, the word "archive" was also without "e". In Andre's old CodeArchive the word is also written without "e". Thank you for your thoughts about SEO and so on. I think I'll remove the "e" again tomorrow.

SicroAtGit commented 6 years ago

"e" removed => https://github.com/SicroAtGit/PureBasic-CodeArchiv-Rebirth/commit/f34bb49f85b35b050adde766d14025ef1bb623a0