Hook: content.render.html

Last updated on May 21, 2026 05:08

Overview

Type: Filter Location: app/Services/ContentRenderer.php

Filters final rendered HTML output from block content. Runs after all blocks are converted to HTML. Use for global content transformations like adding table of contents, lazy-loading images, or injecting ads.

Parameters

Param Type Description
$html string Complete rendered HTML
$blocks array Original block array

Return

Must return string.

Usage Example

Hook::addFilter('content.render.html', function (string $html) {
    return str_replace('<img ', '<img loading="lazy" ', $html);
});

Related Hooks