Comments (5)
@stof Thanks for the suggestion! It is implemented in the master branch.
@localheinz You can now inject the front matter as variables into Twig template, see https://github.com/webuni/front-matter#twig-loader.
from front-matter.
Quick question, have you gotten parsing of front matter to work?
I have been fiddling around with Twig to achieve the following:
- store front matter in Twig templates
- merge context passed to
render()
with data from front matter stored in Twig templates
However, this does not appear to be so easy:
- If you want to use the
LintCommand
to lint Twig templates with front matter, you have to copy, adjust, and eventually replace the entireLintCommand
to allow for manipulating the$template
because thevalidate()
method in theLintCommand
isprivate
. You also have to replace the native filesystem loader with the front matter loader from this package here. Here we need to ignore the front matter, otherwise the tokenizer chokes on the front matter, but we also need to inject the{% line%}
marker (:+1:) to allow for better debugging - If you want to merge the context passed to
render()
with data from front matter stored in Twig templates, that appears to be another can of worms to me.
Have you gotten anything similar to above to work?
from front-matter.
@localheinz I'm not using front matters myself in my templates. I commented here because I provided answers in the issues discussing the feature request in Twig itself
from front-matter.
Thank you!
Is this the issue?
from front-matter.
@localheinz yes (or at least one of them, I don't remember if there was other duplicates)
from front-matter.
Related Issues (5)
- Please upgrade symfony dependencies to 4.x HOT 1
- Adding typehints HOT 2
- Tag new release HOT 1
- Symfony 7 compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from front-matter.