Giter VIP home page Giter VIP logo

Comments (5)

hason avatar hason commented on June 15, 2024 1

@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.

localheinz avatar localheinz commented on June 15, 2024

@stof

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 entire LintCommand to allow for manipulating the $template because the validate() method in the LintCommand is private. 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.

stof avatar stof commented on June 15, 2024

@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.

localheinz avatar localheinz commented on June 15, 2024

@stof

Thank you!

Is this the issue?

from front-matter.

stof avatar stof commented on June 15, 2024

@localheinz yes (or at least one of them, I don't remember if there was other duplicates)

from front-matter.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.