• Dev
  • How to change meta tag for specific route

Anyone here knows how to change meta tag for specific route through backend?

->content(function (Document $document) {
            $document->head[] = '<meta name="Description" CONTENT="my description">';}),

this does the job, but for all the pages (i need only on a specific page like /my-page), i think someone here can help me with this.

i've tried to follow some extension example but seems to be more complex than appear

    Justoverclock I think you might possibly want to use a middleware to do this, to my knowlege there is no way to easily replace HTML contents returned by the backend except middleware. my pre-fetch middleware could possibly be used as an example of writing to a body. But to replace something in the body would need to be done slightly differently. You can take a look at how Middleware are written via the library we use docs. https://docs.laminas.dev/laminas-stratigility/v3/middleware/

    (You can find the Pre-fetch middleware at https://github.com/flarum-tank/middleware/blob/master/src/InsertDNSPrefetch.php to get an idea of how some of the body reading/writing works)

    Yeas Iā€™m reading this, but my question is all of our extension until now does not have custom title and description? Where I can peak to similar code?

    Billion of example into docs šŸ˜‚I will finish for Christmas