Skip to content

Best way to include dynamic data at the sidebar #463

Answered by ayushn21
luctus asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @luctus, I'd recommend extracting the logic to generate the random articles into a Builder class and then use that to cache it or maybe even just hold it in memory as it only needs to last for the duration of the build.

Perhaps the builder could add a list of articles to site.data and in your template you could do something like:

site.data.featured_articles.each { ... }

Does that make sense?

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@luctus
Comment options

@jaredcwhite
Comment options

@luctus
Comment options

@jaredcwhite
Comment options

@luctus
Comment options

Answer selected by luctus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants