• ♡ Sponsor

    Developing Extensions

    #Development #Extension #PHP #Package #Pipe

    The extension interface provides a convenient way of extending Automad's core functionality with custom PHP code while still offering Automad's template syntax. There are basically two types of template language extensions: generic extensions and custom pipe functions. Check out the source of the MetaTags extension to quickly get started with a simple example.

    Generic Extensions

    Generic extension allow for developing more complex and customized template functions of any kind having full access to all content and core functions of Automad. They can be used like standard Toolbox functions.

    <@ Namespace/Function { key: "Value", ... } @>
    

    Find out more about developing and structuring generic functions here.

    Pipe Functions

    In contrast to generic extensions, custom pipe functions are specifically meant to modify the content of a variable by using the pipe operator. They can be used in templates like any other pipe function.

    @{ variable | Namespace/Function }
    

    You can find more information about developing custom pipe functions here.


    More in Developing Extensions

    • Generic Extensions
    • Custom Pipe Functions

    Related

    System  ⁄
    Debugging — System

    During development of extensions it can be handy to see what Automad is doing. Therefore it is possible to send logging information to your browser's console. You can log any item, object or just a text notice using the following method in your extension or theme.

    System  ⁄
    Installing Packages — System

    Automad can be easily extended by installing custom packages. A package can be a theme or a PHP extension or a combination of both. The easiest way to install packages is to use the Packages section on the Automad dashboard. It also helps you to get an overview about available ...

    Developer Guide

    Extensibility is one of the most important features of any software. Basically there are two types of packages to extend the functionality of Automad: themes and extensions. While Automad's template language allows beginners to develop their own themes, it is also possible to use ...

    Developer Guide  ⁄
    Building Themes — Developer Guide

    Themes are an essential part of a content management system. They define the way your content is presented to the visitors of your website. Automad's flexible and intuitive template language enables also inexperienced developers or beginners to create themes and templates on ...

    Template Language  ⁄
    Pipe — Template Language

    A pipe | allows for using the value of a variable to be the input value for a function. It is also possible to chain multiple functions together, so that the output of one function is used as input for the next one. Therefore a pipe can be used to modify the value of a variable ...

    Template Language  ⁄
    Using Extensions — Template Language

    Extensions provide a convenient way of turning custom PHP code into Automad statements. Besides the fact that extensions have to be called by their names including their namespace, the syntax is the same as for Toolbox or pipe functions.

    Building Themes  ⁄
    Plain PHP — Building Themes

    Automad supports plain PHP in template files. However, variables used in plain PHP blocks will not show up automatically in the dashboard and mixing PHP with Automad's template engine should be done carefully. Therefore it is not recommended to use plain PHP in normal templates. ...

    Developing Extensions  ⁄
    Generic Extensions — Developing Extensions

    In case you are missing any advanced feature while developing themes using Automad's template language, you are able to implement that functionality as a generic extension written in plain PHP.

    Developing Extensions  ⁄
    Custom Pipe Functions — Developing Extensions

    Automad provides already some basic string manipulation functions to be used with the pipe operator. However, in some cases it my be necessary to use a custom function to modify the content of a variable. Custom pipe functions can be written in plain PHP. Thier basic setup is ...

    Developer Guide  ⁄
    Publishing Packages — Developer Guide

    Automad uses Composer as dependency manager. Therefore packages can be made public by submitting them as Composer packages to the Packagist website. Published Automad packages also automatically appear in the package browser. The process of releasing a package is basically the ...

    Developer Guide  ⁄
    Editor Plugins — Developer Guide

    To make the development of themes more efficient, it is recommended to install one of the Automad plugins for the editors listed below. Those plugins will add syntax highlighting for the Automad template engine as well as the most common snippets for autocompletion.

    Developer Guide  ⁄
    Cheat Sheets — Developer Guide

    In case you prefer to start developing a theme or extension without reading the full documention, the cheat sheets below are a good point to start. In addition to this page there is also the theme skeleton package available to help you getting started.

    Cheat Sheets  ⁄
    Plain PHP Snippets — Cheat Sheets

    In case you want to develop a new extension or use PHP in your templates, the collection of common code snippets below might help you getting started quickly.

    Cheat Sheets  ⁄
    Creating Theme Packages — Cheat Sheets

    This guide describes step by step the workflow of setting up and publish a new theme. It assumes you're familiar with Visual Code Studio and working on a system with a Bash shell or similar — like macOS or Linux.

    Headless Mode

    Activating the headless mode turns Automad into a back-end only content management system without a presentation layer that focuses entirely on content creation. While the Dashboard can still be used to manage content, all data and files are made accessible via a read-only JSON ...

    Packages

    Browse free Composer packages and install themes and extensions for your Automad site.

    • Automad
    • Developer Guide
    • Developing Extensions
    Discuss
    Packages
    Release Notes
    Support
    Terms of Use
      Become a Sponsor
      GitHub
      Twitter
      Facebook
      Instagram
      2013-2022 by Marc Anton Dahmen
    Released under the MIT license

    A faceless machine, creating one's portrait in the internet.
  • Automad
  • Getting Started
  • System
  • User Guide
  • Developer Guide
  • Headless Mode
  • Discuss
  • Packages
  • Developer Guide ←
  • Developing Extensions
  • Generic Extensions
  • Custom Pipe Functions