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

Document global variables (top-level data:) #9

Open
ad-si opened this issue Sep 29, 2018 · 3 comments
Open

Document global variables (top-level data:) #9

ad-si opened this issue Sep 29, 2018 · 3 comments

Comments

@ad-si
Copy link

ad-si commented Sep 29, 2018

It would be cool if there was a field in the project.yml to define global variables. e.g.

global:
   site_url: example.org
   items_per_page: 10
rules:
  

or is there already a way to accomplish this?

@tdammers
Copy link
Owner

Matter of fact, there is - just define a data key at the top level of your project.yml. This is exactly the feature you're asking for. AFAIK, it's not really documented yet though.

On top of that, remember that the project file is just another YAML file ("YAYAMLF", if you will :P), so you can also use YAML references for things that need to be reused between routes (or between any other things, really - YAML references are resolved at the YAML AST level, before interpreting things as configurations).

The blogg example uses both techniques, so maybe take a look at that.

@ad-si
Copy link
Author

ad-si commented Sep 29, 2018

Ah, cool! The readme says "The most important (and currently only) key in that file is rules, a list of routing rules", that's why I thought there was no way.

Feel free to reopen this issue as "Add documentation about root data field" 😉

@tdammers tdammers changed the title Feature Request: Global variables Document global variables (top-level data:) Sep 29, 2018
@tdammers
Copy link
Owner

Your wish is my command!

@tdammers tdammers reopened this Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants