Allow plugin render hooks to add link tags to the page (#1963)

Adds an extra optional property to plugin render results to allow
plugins to add `<link>` tags to the page.
This commit is contained in:
Adam Gregory
2023-11-08 23:51:14 +01:00
committed by GitHub
parent 1b767233f4
commit 14cecc0a6f
6 changed files with 52 additions and 2 deletions
+4 -1
View File
@@ -80,12 +80,15 @@ client.
The `render` hook needs to synchronously return a
[`PluginRenderResult`](https://deno.land/x/fresh/server.ts?s=PluginRenderResult)
object. Additional CSS and JS modules can be added to be injected into the page
by adding them to `styles` and `scripts` arrays in this object.
by adding them to `styles`, `links` and `scripts` arrays in this object.
`styles` are injected into the `<head>` of the page as inline CSS. Each entry
can define the CSS text to inject, as well as an optional `id` for the style
tag, and an optional `media` attribute for the style tag.
`links` are injected into the `<head>` of the page as `<link>` tags. A link tag
is created for each entry, with attributes from the entry's properties.
`scripts` define JavaScript/TypeScript modules to be injected into the page. The
possibly loaded modules need to be defined up front in the `Plugin#entrypoints`
property. Each defined module must be a JavaScript/TypeScript module that has a