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

Dynamic site properties in base view model #126

Open
mgnslndh opened this issue Sep 10, 2014 · 7 comments
Open

Dynamic site properties in base view model #126

mgnslndh opened this issue Sep 10, 2014 · 7 comments

Comments

@mgnslndh
Copy link

Just like you can have dynamic properties on each post it would be nice to define dynamic site properties that are available on all pages. They could be defined in snow.config like this:

"properties": { "key1": "value1", "key2": "value2"}

This could be useful for themes when you do not want to hard code certain content.

@mgnslndh mgnslndh changed the title Dynamic site properties view models Dynamic site properties in base view model Sep 10, 2014
@Dashue
Copy link
Contributor

Dashue commented Sep 10, 2014

Do you have a use-case you're trying to solve, it sounds like an interesting idea, would be good to know what your perspective is.

@mgnslndh
Copy link
Author

Thanks for the feedback!

The idea struck me when I realized that properties such author, blog title and site url was not available in the base view model, only in the post view model. I would like to use the model to render the name and owner of the site for example. This is usually done in the default layout but the those specific properties from snow.config are not available.

The properties I mentioned above are already part of the configuration and should be possible to provide using the base view model. But there can be other properties that I would like to provide through the base view model such as user account urls for Twitter, GitHub, StackOverflow, Google+ etc. Those might not be of general interest of all Sandra Snow users but it would be nice to be able to configure them in one place and use them in the view models. This allows for more general themes that are more easily shared between users.

@sgrassie
Copy link
Contributor

I've thought about porting this from Jekyll: http://jekyllrb.com/docs/datafiles/

In addition to the built-in variables available from Jekyll, you can specify your own custom data that can be accessed via the Liquid templating system.

Wouldn't that cover your use case?

@mgnslndh
Copy link
Author

Spot on! That would be awesome!

@phillip-haydon
Copy link
Member

This all sounds awesome. I wanted to add dynamic properties to posts but if we can add to global and posts. Would be great.

I'm on holiday untill the 21st so can't help much till then. But keen for dynamic properties!

-----Original Message-----
From: "Magnus Lindhe" [email protected]
Sent: ‎9/‎12/‎2014 1:49 AM
To: "Sandra/Sandra.Snow" [email protected]
Subject: Re: [Sandra.Snow] Dynamic site properties in base view model (#126)

Spot on! That would be awesome!

Reply to this email directly or view it on GitHub.=

@sgrassie
Copy link
Contributor

I've started working on this, I don't have anything to base a PR off yet, and even then I think that there will be a bit of work involved before it's in a state where Phil will accept the pull.

@NelsonReis
Copy link

I would really love to see this coming on a next release 👍

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

5 participants