HTML Structure for Joomla

HTML Structure is a content plugin designed for Joomla 5 and 6. It helps you reuse HTML page code inside articles and Custom HTML modules without nesting a second HTML document inside your Joomla page.

The plugin extracts CSS and JavaScript, registers them through Joomla’s Web Asset Manager, and removes unnecessary document tags. Your saved content stays unchanged—processing happens when the page is displayed.

Main Features

  • Supports articles and Custom HTML modules.

  • Handles external stylesheets, <style> blocks, and external or inline JavaScript.

  • Removes document wrappers such as <html>, <head>, and <body>.

  • Removes pasted titles, metadata, and <base> tags while keeping Joomla’s page settings.

  • Preserves element-level styles such as style="color: red".

  • Lets you select articles by ID or process only content containing a marker.

  • Compatibility: Joomla 5 and 6.

Installation

  1. Download the plugin.

  2. Go to System → Install → Extensions and upload the ZIP.

  3. Open System → Manage → Plugins, find HTML Structure, and enable it.

You can install an update over the existing version.

Using It in Articles

Paste your HTML into the editor’s source-code view, then save the article.

Your editor and Joomla Text Filters must allow the required HTML, CSS, and JavaScript. The plugin cannot restore code removed during saving.

Using It in Custom HTML Modules

  1. Enable Process Custom HTML modules in the plugin settings.

  2. Open your Custom HTML module.

  3. Set Prepare Content to Yes.

  4. Paste your HTML in source-code view and save.

  5. Clear Joomla’s cache.

If module caching causes missing styles or scripts, select No caching for that module.

Settings

Setting Purpose
Article IDs Process specific articles, such as 12,34,56. Leave empty for all articles. Does not restrict modules.
Process Custom HTML modules Enable or disable module support. Enabled by default.
Require marker Process only articles or modules containing <!-- htmlstructure -->.

Important Notes

  • Use JavaScript only from trusted sources. This plugin is not a security filter.

  • CSS can affect the entire Joomla page. Use a unique wrapper class to limit its scope.

  • Scripts that access page elements immediately may need to wait for DOMContentLoaded.

  • Relative URLs may need updating when copying code from another website.

  • The plugin does not download resources or reproduce a complete website.

  • After changes, clear the cache and check the page’s appearance and functionality.

For example, suppose you want to use the source code below for your article:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Welcome Box</title>
  <style>
    .hs-welcome {
      padding: 24px;
      border-radius: 12px;
      background: #eef6ff;
      color: #17365d;
    }

    .hs-welcome button {
      padding: 10px 18px;
      border: 0;
      border-radius: 6px;
      background: #175cd3;
      color: white;
      cursor: pointer;
    }
  </style>
</head>
<body>
  <div class="hs-welcome">
    <h2>Welcome to Our Website!</h2>
    <p>Discover our latest news, tips, and updates.</p>
    <button type="button">Say Hello</button>
  </div>

  <script>
    (() => {
      function initWelcomeBoxes() {
        document.querySelectorAll(".hs-welcome button")
          .forEach((button) => {
            if (button.dataset.hsReady) return;
            button.dataset.hsReady = "true";

            button.addEventListener("click", () => {
              button.textContent = "Thanks for visiting!";
            });
          });
      }

      if (document.readyState === "loading") {
        document.addEventListener(
          "DOMContentLoaded",
          initWelcomeBoxes,
          { once: true }
        );
      } else {
        initWelcomeBoxes();
      }
    })();
  </script>
</body>
</html>

After processing, the article will retain the HTML code as shown below:

<div class="hs-welcome">
    <h2>Welcome to Our Website!</h2>
    <p>Discover our latest news, tips, and updates.</p>
    <button type="button">Say Hello</button>
  </div>

CSS and script tags will be extracted and integrated into the source code via the Joomla framework, ensuring that the website structure functions correctly.

You may also like

How to upload and attach files to Joomla articles

K2 to Content Migration

File Manager Extension for Joomla

Say something here...
You are a guest ( Sign Up ? )
or post as a guest
Loading comment... The comment will be refreshed after 00:00.

Be the first to comment.


Powered By JLex Comment.