Skip to content

vtxm-h/article-insert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

100 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Article Insert (Contao)

Reusable Contao frontend module that renders the published content elements of a selected source article in another module or layout context.

The selected source article itself may remain unpublished and can be used as an internal content container. Only published content elements inside that article are rendered.

Designed for theme- and template-driven setups where structure is handled by templates, layout areas or structural content elements, while content is managed through Contao articles.

Features

  • Frontend module: Article Insert
  • Select source page
  • Select source article
  • Renders all published content elements from the selected source article
  • Allows the selected source article to remain unpublished
  • Prevents recursive article rendering
  • Returns empty output for invalid, missing or recursive article references
  • Useful for:
    • layout areas
    • reusable article-based content blocks
    • template-driven page structures
    • custom template slots
    • one-page layouts
  • Theme-agnostic output
  • Keeps content management inside Contao articles

Usage

Backend -> Themes -> Frontend Modules

  1. Create a new frontend module
  2. Select module type: Article Insert
  3. Select a page
  4. Select the article
  5. Place the module in a layout section, custom template slot or page layout area

The article list depends on the selected page. Selecting a page triggers a backend reload and refreshes the article selector immediately, including before the module is saved for the first time.

Recursion Safety

Article Insert tracks the selected source article while its published content elements are being rendered. If the same article is requested again inside that render chain, the nested attempt returns empty output.

Example:

  1. Article Insert renders Article A.
  2. Article A contains a module content element that renders the same Article Insert module.
  3. The second attempt to render Article A is stopped.

Invalid or deleted source article records also return empty output without rendering broken frontend markup.

Recommended Role

Use this bundle when you need to render a selected article in another module or layout context.

Recommended separation:

  • frontend-assets = shared frontend CSS and JavaScript
  • content-elements = actual reusable content elements
  • section-elements = inline Start / Area / End structures in the current article
  • content-grid = renders article content inside a grid structure
  • article-insert = renders a selected article in another module/layout context
  • layout-preset = macro layout with external slots

Template

mod_article_insert.html5

Installation (via Composer / Contao Manager)

Add the package definition to your Contao project composer.json or install it via your configured repository setup.

Example package reference:

{
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "vtxm-h/article-insert",
        "version": "1.1.5",
        "type": "contao-bundle",
        "license": "MIT",
        "dist": {
          "url": "https://github.com/vtxm-h/article-insert/archive/refs/tags/v1.1.5.zip",
          "type": "zip"
        },
        "autoload": {
          "psr-4": {
            "Vendor\\ArticleInsertBundle\\": "src/"
          }
        },
        "require": {
          "php": "^8.0",
          "contao/core-bundle": "^4.13",
          "contao/manager-plugin": "^2.0",
          "vtxm-h/contao-dca-helpers": "^1.0"
        },
        "extra": {
          "contao-manager-plugin": "Vendor\\ArticleInsertBundle\\ContaoManager\\Plugin"
        }
      }
    }
  ]
}

Install:

composer require vtxm-h/article-insert

Compatibility

Contao 4.13 PHP 8.0+

License

MIT

About

Frontend module that allows articles to be embedded into layouts or other pages.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages