diff --git a/src/config.ts b/src/config.ts index 2408b267e9c01..822a25fa43bd7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -32,9 +32,9 @@ export const SIDEBAR = { { text: 'Import Aliases', link: 'en/guides/aliases' }, { text: 'Integrations', link: 'en/guides/integrations-guide' }, { text: 'RSS', link: 'en/guides/rss' }, + { text: 'Server-side Rendering (SSR)', link: 'en/guides/server-side-rendering' }, { text: 'TypeScript', link: 'en/guides/typescript' }, { text: 'UI Frameworks', link: 'en/core-concepts/framework-components' }, - { text: 'Server-side Rendering (experimental)', link: 'en/guides/server-side-rendering' }, { text: 'Reference', header: true, type: 'api' }, { @@ -46,6 +46,7 @@ export const SIDEBAR = { { text: 'Integrations API', link: 'en/reference/integrations-reference' }, { text: 'Adapter API (experimental)', link: 'en/reference/adapter-reference' }, { text: 'Routing Rules', link: 'en/core-concepts/routing' }, + { text: 'Templating Directives', link: 'en/reference/directives-reference' }, // ADD: Astro Component Syntax // ADD: Markdown Syntax { text: 'NPM Package Format', link: 'en/guides/publish-to-npm' }, diff --git a/src/pages/en/core-concepts/astro-components.md b/src/pages/en/core-concepts/astro-components.md index 1b466039b2cf5..aca5d536242d5 100644 --- a/src/pages/en/core-concepts/astro-components.md +++ b/src/pages/en/core-concepts/astro-components.md @@ -324,7 +324,6 @@ They can be used to style your components, and all style rules are automatically To send JavaScript to the browser without [using a framework component](/en/core-concepts/framework-components) (React, Svelte, Vue, Preact, SolidJS, AlpineJS, Lit...) you can use a ` ``` + +๐Ÿ“š See our [directives reference](/en/reference/directives-reference#script-and-style-tags) page for more information about the directives available on ` +``` + +>โš ๏ธ Using `define:vars` on a ` + + + + +``` + +### `is:global` + +Make the contents of a ` + + + +``` + +## HTML elements + +These directives can be used on any HTML element, even the lowly `
`. + +### `set:html={html}` + +Inject an HTML string into an element without it being escaped. + +```astro +--- +const title = "Hello World" +--- +

{title}

+

+``` + +You can also use it on a `` to avoid adding a wrapper element. + +```astro +--- +const cmsContent = await fetchDataFromMyCMS(); +--- + +``` + +### `set:text={text}` + +The opposite of `set:html`. `set:text` ensures that any HTML content passed to it is escaped. + +This is the default behavior without using any directives though, so there aren't really any use cases for it other than making it clear that the content is being escaped properly. + +```astro +--- +const potentialyDangerousContent = await fetchUserGeneratedContent(); +--- + +```