# templating

Published articles for templating.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Going Global with Twig Globals in Craft CMS

DevFeed: [Going Global with Twig Globals in Craft CMS](<https://devfeed.tech/articles/going-global-with-twig-globals-in-craft-cms-31265.md>)

Original publisher: [Read original article](<https://nystudio107.com/blog/going-global-with-twig-globals-in-craft-cms>)

Author: andrew@nystudio107.com (Andrew Welch)

Published: 2024-09-02T18:25:00Z

Content type: tutorial

Language: en

Sources: [nystudio107 | Articles on modern web development.](<https://devfeed.tech/sources/nystudio107-articles-on-modern-web-development.md>)

Topics: [Content Management System](<https://devfeed.tech/topics/cms.md>), [Web](<https://devfeed.tech/topics/web.md>), [coding](<https://devfeed.tech/topics/coding.md>)

Tags: [added](<https://devfeed.tech/tags/added.md>), [article](<https://devfeed.tech/tags/article.md>), [challenges](<https://devfeed.tech/tags/challenges.md>), [cms](<https://devfeed.tech/tags/cms.md>), [collection](<https://devfeed.tech/tags/collection.md>), [craft](<https://devfeed.tech/tags/craft.md>), [global](<https://devfeed.tech/tags/global.md>), [globals](<https://devfeed.tech/tags/globals.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [insights](<https://devfeed.tech/tags/insights.md>), [learn](<https://devfeed.tech/tags/learn.md>), [leveraging](<https://devfeed.tech/tags/leveraging.md>), [simplify](<https://devfeed.tech/tags/simplify.md>), [templating](<https://devfeed.tech/tags/templating.md>), [twig](<https://devfeed.tech/tags/twig.md>), [variables](<https://devfeed.tech/tags/variables.md>)

### AI overview

This tutorial explains how variable scope works in Twig templates used by Craft CMS, including the challenges of making variables globally available. It discusses the trade-offs of global variables and how they can reduce component reusability and modularity, while noting that they can be appropriate in simpler websites.

### Source excerpt

Learn how to simplify some Twig templating challenges by leveraging the global variables & the _globals Collection added in Craft CMS 4.5

## An Effective Twig Base Templating Setup

DevFeed: [An Effective Twig Base Templating Setup](<https://devfeed.tech/articles/an-effective-twig-base-templating-setup-31241.md>)

Original publisher: [Read original article](<https://nystudio107.com/blog/an-effective-twig-base-templating-setup>)

Author: andrew@nystudio107.com (Andrew Welch)

Published: 2019-11-21T01:29:00Z

Content type: tutorial

Language: en

Sources: [nystudio107 | Articles on modern web development.](<https://devfeed.tech/sources/nystudio107-articles-on-modern-web-development.md>)

Topics: [Content Management System](<https://devfeed.tech/topics/cms.md>), [Template](<https://devfeed.tech/topics/template.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [Development](<https://devfeed.tech/topics/development.md>), [Front end](<https://devfeed.tech/topics/frontend.md>)

Tags: [base](<https://devfeed.tech/tags/base.md>), [build](<https://devfeed.tech/tags/build.md>), [cms](<https://devfeed.tech/tags/cms.md>), [craft](<https://devfeed.tech/tags/craft.md>), [foundation](<https://devfeed.tech/tags/foundation.md>), [good](<https://devfeed.tech/tags/good.md>), [insights](<https://devfeed.tech/tags/insights.md>), [projects](<https://devfeed.tech/tags/projects.md>), [provides](<https://devfeed.tech/tags/provides.md>), [setup](<https://devfeed.tech/tags/setup.md>), [solid](<https://devfeed.tech/tags/solid.md>), [stable](<https://devfeed.tech/tags/stable.md>), [templates](<https://devfeed.tech/tags/templates.md>), [templating](<https://devfeed.tech/tags/templating.md>), [twig](<https://devfeed.tech/tags/twig.md>)

### AI overview

This tutorial presents a reusable Twig base templating setup for Craft CMS websites. It explains the role of Twig as a presentation layer and outlines desired capabilities, including reuse across projects, support for web pages and AJAX/XHR modals, core features with flexibility, and Google AMP pages when appropriate.

### Source excerpt

A good base templating setup for your Craft CMS Twig templates provides a stable, solid foundation on which to build your projects

## Frameworkless JavaScript Part 2: Templates and Rendering

DevFeed: [Frameworkless JavaScript Part 2: Templates and Rendering](<https://devfeed.tech/articles/frameworkless-javascript-part-2-templates-and-rendering-32302.md>)

Original publisher: [Read original article](<https://jack.ofspades.com/frameworkless-javascript-part-2-templates-and-rendering/>)

Author: Jack Tarantino

Published: 2017-01-08T18:19:00Z

Content type: tutorial

Language: en

Sources: [Jacopo Tarantino](<https://devfeed.tech/sources/jacopo-tarantino.md>)

Topics: [Vanilla JavaScript](<https://devfeed.tech/topics/vanilla-js.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Code](<https://devfeed.tech/topics/code.md>), [Framework](<https://devfeed.tech/topics/framework.md>)

Tags: [best-practices](<https://devfeed.tech/tags/best-practices.md>), [code](<https://devfeed.tech/tags/code.md>), [frameworks](<https://devfeed.tech/tags/frameworks.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [templates](<https://devfeed.tech/tags/templates.md>), [templating](<https://devfeed.tech/tags/templating.md>), [vanilla-javascript](<https://devfeed.tech/tags/vanilla-javascript.md>)

### AI overview

This tutorial explains how to implement basic HTML templating and string interpolation with vanilla JavaScript, using native APIs and methods instead of libraries or frameworks.

### Source excerpt

This article is one in a series about writing client-focused JavaScript without the help of libraries and frameworks. It's meant to help developers remember that they can write good code on their own using nothing but native APIs and methods. For more, check out the original article on writing small

## Twig Processing Order & Scope

DevFeed: [Twig Processing Order & Scope](<https://devfeed.tech/articles/twig-processing-order-scope-31310.md>)

Original publisher: [Read original article](<https://nystudio107.com/blog/twig-processing-order-and-scope>)

Author: andrew@nystudio107.com (Andrew Welch)

Published: 2016-11-28T15:31:00Z

Content type: tutorial

Language: en

Sources: [nystudio107 | Articles on modern web development.](<https://devfeed.tech/sources/nystudio107-articles-on-modern-web-development.md>)

Topics: [Template](<https://devfeed.tech/topics/template.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [Code](<https://devfeed.tech/topics/code.md>), [Content Management System](<https://devfeed.tech/topics/cms.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [frontend](<https://devfeed.tech/tags/frontend.md>), [important](<https://devfeed.tech/tags/important.md>), [insights](<https://devfeed.tech/tags/insights.md>), [language](<https://devfeed.tech/tags/language.md>), [little-known](<https://devfeed.tech/tags/little-known.md>), [order](<https://devfeed.tech/tags/order.md>), [processing](<https://devfeed.tech/tags/processing.md>), [scope](<https://devfeed.tech/tags/scope.md>), [templates](<https://devfeed.tech/tags/templates.md>), [templating](<https://devfeed.tech/tags/templating.md>), [twig](<https://devfeed.tech/tags/twig.md>), [understand](<https://devfeed.tech/tags/understand.md>)

### AI overview

This tutorial explains Twig's processing order and variable scope. It describes how extended, included, and block templates are processed, and why variables defined in one template context are not available in others.

### Source excerpt

The Twig templating language has a little-known processing order & scope that is important to understand

## Using Enlive for HTML templating in Clojure web applications

DevFeed: [Using Enlive for HTML templating in Clojure web applications](<https://devfeed.tech/articles/middleman-enlive-the-best-thing-since-php-32144.md>)

Original publisher: [Read original article](<https://adambard.com/blog/middleman-enlive-your-new-god/>)

Published: 2013-04-02T00:00:00Z

Content type: opinion

Language: en

Sources: [Adam Bard](<https://devfeed.tech/sources/adam-bard.md>)

Topics: [Clojure](<https://devfeed.tech/topics/clojure.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [Library](<https://devfeed.tech/topics/library.md>), [HTML](<https://devfeed.tech/topics/html.md>)

Tags: [clojure](<https://devfeed.tech/tags/clojure.md>), [html](<https://devfeed.tech/tags/html.md>), [library](<https://devfeed.tech/tags/library.md>), [templating](<https://devfeed.tech/tags/templating.md>), [web](<https://devfeed.tech/tags/web.md>), [web-development](<https://devfeed.tech/tags/web-development.md>)

### AI overview

The author discusses using Clojure for web development and presents Enlive as an alternative to conventional templating languages. Enlive parses a fully formed HTML document as a template and applies transformation rules to attributes, text, and elements so HTML mockups can be used with data-driven applications.

### Source excerpt

Before I begin, the ideas in this article were introduced to me by this blog post, which I consider a must-read for anyone who uses Clojure on the web. I've been using Clojure for web development a lot more lately. This can be a contentious topic for some people. "Clojure is hard to hire for", they say. "It's for pretentious nerds". "It's overkill for the web".