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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creating snippets to optimize some builds #8867

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

ashmaroli
Copy link
Member

@ashmaroli ashmaroli commented Oct 31, 2021

  • This is a 馃檵 feature or enhancement.
  • I've added tests.

Problem

Converters do not run on layouts and includes. Therefore, if a user wishes to insert a chunk of Markdown text or code as part of a layout, the workaround is to use {% capture ... %}... followed by rendering the variable through the markdownify filter.
When this routine is part of a layout or include, the probability of rendering the variable numerous times (producing the same markup output) is high.
Such a routine could be optimized if there were a builtin way to have the chunk of Markdown text rendered once and then inserted multiple times.

Solution

Part A -- Jekyll::Snippet

Introduce new entity Jekyll::Snippet that is rendered (like any Page or Document) on demand yet only once per build.

More details in documentation.

Part B -- {% snippet ... %}

Introduce new Liquid Tag {% snippet ... %} to include / insert rendered output of desired snippet.

More details in documentation.

@ashmaroli ashmaroli requested review from mattr- and parkr October 2, 2022 15:24
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

Successfully merging this pull request may close these issues.

None yet

1 participant