{"id":66843,"date":"2016-12-03T10:34:57","date_gmt":"2016-12-03T10:34:57","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=66843"},"modified":"2023-02-16T07:24:02","modified_gmt":"2023-02-16T07:24:02","slug":"use-twig-template-engine-magento2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/","title":{"rendered":"How To Add And Use Twig Template Engine in Magento2"},"content":{"rendered":"<p>Here we will see how to implement twig template engine in magento2.<br \/>\nAs you already know Magento2 uses many new features and technologies. There is a feature in Magento2 by which we can use additional template engine for templating purpose.<br \/>\nIn this article we will learn how we can implement twig with magento2.<br \/>\nTwig is a template engine which is very fast, secure and flexible.<br \/>\nFor more details about twig template <a href=\"http:\/\/twig.sensiolabs.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">click here<\/a>.<\/p>\n<h2>Twig Template Engine in Magento2<\/h2>\n<p>Follow these three steps to include twig template engine in magento2.<\/p>\n<ul>\n<li>Include twig package<\/li>\n<li>Set template engine in di.xml<\/li>\n<li>Include twig package<\/li>\n<\/ul>\n<h3>Step 1- Include twig package<\/h3>\n<p>First of all you have to include twig package in magento2. To include twig package edit compose.json file and add line\u00a0<strong>&#8220;twig\/twig&#8221;: &#8220;~1.28.2&#8221;<\/strong> in require section<\/p>\n<pre class=\"brush:plain\">\"require\": {\n    \"twig\/twig\": \"~1.28.2\"\n}<\/pre>\n<p>After this run composer:update command from terminal. Now twig package is included in your magento.<br \/>\nYou can check it in vendor folder. You will see a twig folder there.<br \/>\n<strong>1.28.2<\/strong> is the version of twig package.<\/p>\n<h3>Step 2- Set template engine in di.xml<\/h3>\n<p>After including twig package now its time to configure magento.<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\"?&gt;\n&lt;config xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:ObjectManager\/etc\/config.xsd\"&gt;\n    &lt;type name=\"Magento\\Framework\\View\\TemplateEngineFactory\"&gt;\n        &lt;arguments&gt;\n            &lt;argument name=\"engines\" xsi:type=\"array\"&gt;\n                &lt;item name=\"twig\" xsi:type=\"string\"&gt;Webkul\\Twig\\View\\TemplateEngine\\Twig&lt;\/item&gt;\n            &lt;\/argument&gt;\n        &lt;\/arguments&gt;\n    &lt;\/type&gt;\n&lt;\/config&gt;\n<\/pre>\n<h3>Step 3- Configure twig template file<\/h3>\n<p>Create Twig.php class as you defined it in di.xml file and extend it by class \\Magento\\Framework\\View\\TemplateEngine\\Php<\/p>\n<pre class=\"brush:php\">&lt;?php\nnamespace Webkul\\Twig\\View\\TemplateEngine;\n\nuse Magento\\Framework\\View\\TemplateEngine\\Php;\nuse Magento\\Framework\\App\\Filesystem\\DirectoryList;\n\nclass Twig extends Php\n{\n    \/**\n     * @var \\Twig_Environment\n     *\/\n    protected $_twig;\n\n    \/**\n     * Base Directory Path\n     *\/\n    protected $_baseDir;\n\n    \/**\n     * @var \\Magento\\Framework\\App\\Filesystem\\DirectoryList\n     *\/\n    protected $_directoryList;\n\n    \/**\n     * Constructor\n     *\/\n    public function __construct(\n        DirectoryList $directoryList\n    ) {\n        $this-&gt;_directoryList = $directoryList;\n        $this-&gt;_baseDir = $this-&gt;getBaseDir();\n        $this-&gt;loadTwig();\n    }\n\n    \/**\n     * Initialize Twig \n     *\/\n    protected function loadTwig()\n    {\n        \\Twig_Autoloader::register();\n        $loader = new \\Twig_Loader_Filesystem($this-&gt;_baseDir);\n        $this-&gt;_twig = new \\Twig_Environment($loader);\n    }\n\n    \/**\n     * Get Base Directory Path\n     *\/\n    public function getBaseDir()\n    {\n        return $this-&gt;_directoryList-&gt;getPath(DirectoryList::ROOT).\"\/\";\n    }\n\n    \/**\n     * Render Template\n     *\/\n    public function render(\\Magento\\Framework\\View\\Element\\BlockInterface $block, $fileName, array $dictionary = [])\n    {\n        $this-&gt;_currentBlock = $block; \/\/ set current block instance for further use\n        $template = str_replace($this-&gt;_baseDir, '', $fileName); \/\/ get path of template file from magento root directory\n        return $this-&gt;_twig-&gt;loadTemplate($template)-&gt;render($dictionary); \/\/ load twig template\n    }\n}<\/pre>\n<p><strong>Note:\u00a0\u00a0<\/strong>If in case you are using Twig version <strong>3.x. <\/strong>, then configure the twig template file as mentioned below.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">&lt;?php\nnamespace Webkul\\Twig\\View\\TemplateEngine;\n\nuse Magento\\Framework\\View\\TemplateEngine\\Php;\nuse Magento\\Framework\\App\\Filesystem\\DirectoryList;\n\nclass Twig extends Php\n{\n    public const PATH_TO_TEMP = \"app\/code\/Webkul\/Twig\/view\/frontend\/templates\/\";\n    \/**\n     * @var \\Twig_Environment\n     *\/\n    protected $_twig;\n\n    \/**\n     * Base Directory Path\n     *\/\n    protected $_baseDir;\n\n    \/**\n     * @var \\Magento\\Framework\\App\\Filesystem\\DirectoryList\n     *\/\n    protected $_directoryList;\n\n    \/**\n     * Constructor\n     *\/\n    public function __construct(\n        DirectoryList $directoryList\n    ) {\n        $this-&gt;_directoryList = $directoryList;\n        $this-&gt;_baseDir = $this-&gt;getBaseDir();\n        $this-&gt;loadTwig();\n    }\n\n    \/**\n     * Initialize Twig \n     *\/\n    protected function loadTwig()\n    {\n        $dir = $this-&gt;_baseDir.self::PATH_TO_TEMP;\n        $loader = new \\Twig\\Loader\\FilesystemLoader($dir);\n        $this-&gt;_twig = new \\Twig\\Environment($loader);\n    }\n\n    \/**\n     * Get Base Directory Path\n     *\/\n    public function getBaseDir()\n    {\n        return $this-&gt;_directoryList-&gt;getPath(DirectoryList::ROOT).\"\/\";\n    }\n\n    \/**\n     * Render Template\n     *\/\n    public function render(\\Magento\\Framework\\View\\Element\\BlockInterface $block, $fileName, array $dictionary = [])\n    {\n        $this-&gt;_currentBlock = $block; \/\/ set current block instance for further use\n        $pathToTemp = $this-&gt;_baseDir.self::PATH_TO_TEMP;\n        $fileName = trim(str_replace($pathToTemp, \"\", $fileName));\n        return $this-&gt;_twig-&gt;render($fileName,$dictionary); \/\/ render twig template\n    }\n}<\/pre>\n<p>Everything is ready now. You can use twig extension files for templating.<br \/>\nHere is an example. I just called a twig template file on home page.<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\"?&gt;\n&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" layout=\"1column\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\"&gt;\n    &lt;body&gt;\n        &lt;referenceContainer name=\"content\"&gt;\n            &lt;block class=\"Magento\\Framework\\View\\Element\\Template\" name=\"test.twig\" template=\"Webkul_Twig::sample.twig\"\/&gt;\n        &lt;\/referenceContainer&gt;\n    &lt;\/body&gt;\n&lt;\/page&gt;\n<\/pre>\n<p>And the output of this snippet will be same as the screenshot.<br \/>\n<img decoding=\"async\" class=\"alignnone size-full wp-image-66862\" src=\"http:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/twig.png\" alt=\"Twig Template\" width=\"1509\" height=\"742\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/twig.png 1509w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/twig-250x123.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/twig-300x148.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/twig-768x378.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/twig-1200x590.png 1200w\" sizes=\"(max-width: 1509px) 100vw, 1509px\" loading=\"lazy\" \/><br \/>\nThat&#8217;s all for twig template engine in magento2.<br \/>\nIf you have any issue or query, comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here we will see how to implement twig template engine in magento2. As you already know Magento2 uses many new features and technologies. There is a feature in Magento2 by which we can use additional template engine for templating purpose. In this article we will learn how we can implement twig with magento2. Twig is <a href=\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":21,"featured_media":66844,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[2873,2712],"class_list":["post-66843","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento2","tag-template-engine","tag-twig"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Add And Use Twig Template Engine in Magento2 - Webkul Blog<\/title>\n<meta name=\"description\" content=\"We can use twig template engine in magento2. Twig Template engine is fast, secure and flexible. we can not execute php code in twig template files.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Add And Use Twig Template Engine in Magento2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"We can use twig template engine in magento2. Twig Template engine is fast, secure and flexible. we can not execute php code in twig template files.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rahul0989\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-03T10:34:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-16T07:24:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\" \/>\n\t<meta property=\"og:image:width\" content=\"825\" \/>\n\t<meta property=\"og:image:height\" content=\"260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Rahul Mahto\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rahul Mahto\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/\"},\"author\":{\"name\":\"Rahul Mahto\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/3002e6bca8362f6cf1c61b2663496c4f\"},\"headline\":\"How To Add And Use Twig Template Engine in Magento2\",\"datePublished\":\"2016-12-03T10:34:57+00:00\",\"dateModified\":\"2023-02-16T07:24:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/\"},\"wordCount\":299,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\",\"keywords\":[\"template-engine\",\"twig\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/\",\"url\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/\",\"name\":\"How To Add And Use Twig Template Engine in Magento2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\",\"datePublished\":\"2016-12-03T10:34:57+00:00\",\"dateModified\":\"2023-02-16T07:24:02+00:00\",\"description\":\"We can use twig template engine in magento2. Twig Template engine is fast, secure and flexible. we can not execute php code in twig template files.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png\",\"width\":825,\"height\":260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Add And Use Twig Template Engine in Magento2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/3002e6bca8362f6cf1c61b2663496c4f\",\"name\":\"Rahul Mahto\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b0def172ef24ea3f7319500afbb65af8012023ba5c143982a4c958b2fb58ee0d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b0def172ef24ea3f7319500afbb65af8012023ba5c143982a4c958b2fb58ee0d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Rahul Mahto\"},\"sameAs\":[\"http:\/\/webkul.com\",\"https:\/\/www.facebook.com\/rahul0989\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/rahul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Add And Use Twig Template Engine in Magento2 - Webkul Blog","description":"We can use twig template engine in magento2. Twig Template engine is fast, secure and flexible. we can not execute php code in twig template files.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/","og_locale":"en_US","og_type":"article","og_title":"How To Add And Use Twig Template Engine in Magento2 - Webkul Blog","og_description":"We can use twig template engine in magento2. Twig Template engine is fast, secure and flexible. we can not execute php code in twig template files.","og_url":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_author":"https:\/\/www.facebook.com\/rahul0989","article_published_time":"2016-12-03T10:34:57+00:00","article_modified_time":"2023-02-16T07:24:02+00:00","og_image":[{"width":825,"height":260,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","type":"image\/png"}],"author":"Rahul Mahto","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Rahul Mahto","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/"},"author":{"name":"Rahul Mahto","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/3002e6bca8362f6cf1c61b2663496c4f"},"headline":"How To Add And Use Twig Template Engine in Magento2","datePublished":"2016-12-03T10:34:57+00:00","dateModified":"2023-02-16T07:24:02+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/"},"wordCount":299,"commentCount":1,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","keywords":["template-engine","twig"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/","url":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/","name":"How To Add And Use Twig Template Engine in Magento2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#primaryimage"},"thumbnailUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","datePublished":"2016-12-03T10:34:57+00:00","dateModified":"2023-02-16T07:24:02+00:00","description":"We can use twig template engine in magento2. Twig Template engine is fast, secure and flexible. we can not execute php code in twig template files.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2016\/12\/Magneto-Code-Snippet.png","width":825,"height":260},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/use-twig-template-engine-magento2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Add And Use Twig Template Engine in Magento2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/3002e6bca8362f6cf1c61b2663496c4f","name":"Rahul Mahto","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b0def172ef24ea3f7319500afbb65af8012023ba5c143982a4c958b2fb58ee0d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b0def172ef24ea3f7319500afbb65af8012023ba5c143982a4c958b2fb58ee0d?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Rahul Mahto"},"sameAs":["http:\/\/webkul.com","https:\/\/www.facebook.com\/rahul0989"],"url":"https:\/\/webkul.com\/blog\/author\/rahul\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/66843","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=66843"}],"version-history":[{"count":26,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/66843\/revisions"}],"predecessor-version":[{"id":369090,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/66843\/revisions\/369090"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media\/66844"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=66843"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=66843"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=66843"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}