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

The site variable isn't present within Ruby front matter #372

Closed
jaredcwhite opened this issue Aug 29, 2021 · 3 comments
Closed

The site variable isn't present within Ruby front matter #372

jaredcwhite opened this issue Aug 29, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@jaredcwhite
Copy link
Member

Given Ruby front matter of this:

front_matter do
  layout :default
  title site.metadata.podcast_title
end

It produces an error because the front matter is evaluated within an instance of RepoOrigin which doesn't provide a site accessor.

@jaredcwhite jaredcwhite added the bug Something isn't working label Aug 29, 2021
@jaredcwhite
Copy link
Member Author

Perhaps one possible answer is to use the lambda functionality for later evaluation (as that is evaluated within an instance of the resource itself):

title ->{ site.metadata.podcast_title }

However, I'm getting an empty {} metadata in that case, so there's still a bug somewhere. :(

@jaredcwhite
Copy link
Member Author

Ah, it's because the time the evaluation happens is still within the loop of reading collections and the data collection apparently hasn't been read and merged into the site data tree yet. We need to frontload the data collection getting read in before any other collection!

@jaredcwhite
Copy link
Member Author

I think the lambda function along with the fix in #373 is sufficient to resolve this matter. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant