Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common MetaData for multilanguage pages #757

Closed
cord opened this issue Mar 31, 2016 · 7 comments
Closed

Common MetaData for multilanguage pages #757

cord opened this issue Mar 31, 2016 · 7 comments

Comments

@cord
Copy link

cord commented Mar 31, 2016

working with multiple languages I find myself copying common meta-data / header settings between the language variants.

Would be great to have a solution, where there is first loaded a common meta data file, which then might be overwritten by the actual language files, e.g.

/default.meta.yaml    <- common meta data, header etc
/default.en.md <- partially overrides for EN
/default.de.md <- partially overrides for DE
@bovisp
Copy link
Contributor

bovisp commented Mar 31, 2016

@cord Having nearly completed an entire site translation myself using Grav, I think this is an excellent idea.

@rhukster
Copy link
Member

rhukster commented Apr 2, 2016

Due to the performance enhancing decisions we made with the design of the multi-language support in Grav, this is really not possible. This is because Grav only knows about one language at a time, there's no way for Grav to look in 'parent' languages and 'merge' things.

Grav will fall back through the supported languages if a particular language file is not found, however, this really not the same because it only happens during the initial caching phase, and once a file is found, it's processed.

So ultimately this concern is one of performance. Having every single page parsing every other language file and merging is going to cause huge performance problems. I really can't see how this could be done efficiently. If you have any ideas i'm open to listen to them.

@cord
Copy link
Author

cord commented Apr 2, 2016

Hi Andy,

In my view grav would "only" need to look for default.meta.yaml and - if exists - read it and create the meta data structure before loading the language specific .md file which would then complete the meta data or eventually override settings.

There would be one default.meta.yaml file per page folder.

@alardw
Copy link

alardw commented Apr 6, 2016

I agree with cord. Duplication of (meta) data is error-prone. A single meta data yaml would only have a minor performance penalty.

@rhukster
Copy link
Member

rhukster commented Apr 6, 2016

Ok, I created a PR for a solution to this. I made it a generic frontmatter.yaml file that was used so you could set any header (including metadata).

#775

IMPORTANT Please read my comments about the caveats of this: #775 (comment)

metadata:
    generator: 'Super Grav'
    description: from frontmatter.yaml file

is my test case.

@rhukster
Copy link
Member

rhukster commented Apr 6, 2016

Anyway, performance-wise this extra check added 3ms to my 100page test site (before caching).

@flaviocopes
Copy link
Contributor

Closing as the PR #775 was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants