nielsnicola/kirby-hide-html-comments

Hide HTML comments in Kirby output

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:kirby-plugin

pkg:composer/nielsnicola/kirby-hide-html-comments

1.0.0 2025-11-25 20:39 UTC

This package is auto-updated.

Last update: 2025-12-25 20:56:30 UTC


README

Hide or show HTML comments in your Kirby templates using a simple helper function: comment().

Installation

Composer

composer require nielsnicola/kirby-hide-html-comments

Git submodule

git submodule add https://github.com/nielsnicola/kirby-hide-html-comments.git site/plugins/kirby-hide-html-comments

Manual installation

Download this repository and place it in:

site/plugins/kirby-hide-html-comments

Options

Add one config option to control the output of HTML comments:

Option Default Description
nielsnicola.hide-html-comments.enabled true true hides all comments; false shows comments in the DOM

Usage

Once installed, you can use the global comment() helper in any template:

<?php comment('Hero section starts'); ?> // 
<div class="hero">
  ...
</div>
<?php comment('Hero section ends'); ?>

Config example

// site/config/config.php
return [
    'nielsnicola.hide-html-comments.enabled' => true, // Set to false to show HTML comments
];
  • When enabled is true, comment() outputs nothing
  • When enabled is false, comment() outputs standard HTML comments in the DOM.