DlPrompter

Prompt the search index and AI Assistant with hidden, removable content inserts

The DlPrompter inline (utility) component renders content that is visually hidden but remains accessible to search engines and screen readers. It's particularly useful for adding searchable keywords or context that shouldn't be visible to users but should be indexed.

The Why

Sometimes you need to include additional context or keywords in your content for search purposes without cluttering the visual presentation. DlPrompter provides a clean way to add this hidden content while maintaining accessibility standards.

This component will be very helpful while defining in-content prompts for AI models, where you want to include additional context or instructions that should not be visible to end users but might be essential for generating accurate Assistant responses - used by the @vuehouse/dl-search module.

Features

  • 👁️ visually hidden content that remains accessible
  • 🔍 search engine indexable content
  • 🏷️ configurable HTML tag for semantic structure
  • 🧩 flexible content via prop or slot
  • 🪄 can be stripped from the markup when needed

Usage

Use :dl-prompter[...] as an inline component with the content provided through the default slot or the content prop.

:dl-prompter[Vue.js, Nuxt.js, documentation, tutorial"]

Result: (content is hidden but searchable)

With slot content

You can also provide content through the default slot for more complex markup. For this scenario use DlPrompter as a block component.

::dl-prompterFirst line of the extended prompt.Second line of the extended prompt goes after.::

Result: (content is hidden but searchable)

With custom tag

Use the tag prop to specify the HTML element for better semantic structure.

:dl-prompter[SEO keywords and context]{tag="section"}

Result: (content is hidden but searchable)

Strip prompts

By default, DlPrompter inserts are removed from the final rendered markup, so their content is available only to the internal search engine. The source content is preserved in the parsed data and becomes searchable through the application's search and/or AI assistant. If you want to keep these prompts in the final HTML markup, change the module option and set stripPrompts to false.

Props

Here are the properties you can use with the DlPrompter component. Each property should be set on an individual component instance; they do not affect the global configuration. More about defining properties in MDC components you can read here.

nametypedefaultdescription
contentstringundefined

Content to be displayed in the hidden component. Takes priority over the default slot.

tag

union composed from
available tag names

span

HTML tag to use for the hidden content. Available tags: span, p, div, section, article.

Slots

namedescription
default

Default slot for the hidden content. Takes precedence over the content prop.

Accessibility

The hidden content provided by DlPrompter is accessible to screen readers, indexed by search engines, and benefits from semantic HTML. Unless you will strip it from the final markup.