Linking Markdown Documentation to Website Elements
In short
You do not need to duplicate the list of ai_context_ids in frontmatter. Write a normal human instruction and wrap the important phrase in span data-ai-context-id. During import, Senler AI extracts these keys and shows them in the "Context keys for elements" field.
The main principle: the same data-ai-context-id must exist on the page element and in the article text. Then the user reads a normal instruction, while the selected place is linked to the right interface step.
How an ideal link should work
- The site owner marks a button, field or card with the
data-ai-context-idattribute. - The same key is specified in the Markdown document for this function.
- The document is uploaded to the knowledge base.
- The key is saved in the
ai_context_idsfile field. - The visitor selects an element in the widget and asks a question.
- Senler AI receives the selected element as a context chip next to the message. The same area may also contain page, project, or other business entity chips.
- Knowledge base search prioritizes documents where the "Context keys for elements" field contains this key.
How import reads Markdown
Upload MD/ZIP for files .md, .mdc, .markdown reads YAML frontmatter at the beginning of the document and inline markup data-ai-context-id in the body of the article.
During import, Senler AI does four things:
- extracts
data-ai-context-idfrom the article text and transfers them to the "Context keys for elements" field; - saves article properties (
doc_id,keywords,route,ui_entities,user_questions) as file metadata; - puts the body of the document without frontmatter into the visible
content; - adds metadata to the search layer so that the knowledge base finds the document by keys and synonyms, while the user does not see the YAML header as page text.
After ZIP upload, it is still useful to open several files selectively and check the "Context keys for elements" field: this helps catch YAML errors or context id typos quickly.
Recommended MD format
Frontmatter is needed as a private header for article properties. The connection with the interface element does not live in the frontmatter, but directly in the text phrase.
---
doc_id: "site.checkout.payment"
title: "Order Payment"
keywords:
- "payment"
- "card"
- "order"
search_queries:
- "how to pay for an order"
- "why payment fails"
---
In the body of the document, link the phrase to the element:
<span data-ai-context-id="checkout.payment.submit">Click the payment button</span>
to continue to order payment.
Appropriate site markup
<form data-ai-area="form" data-ai-section="checkout-payment">
<button
data-ai-label="Pay for order"
data-ai-kind="primary-action"
data-ai-action="checkout.payment.submit"
data-ai-context-id="checkout.payment.submit"
data-ai-kb-query="how to pay for an order"
>
Pay
</button>
</form>
What to choose: context_id, kb_query or kb_doc_id
data-ai-context-id- the main option. It is stable, human-readable, and is saved in the "Context keys for elements" field.data-ai-kb-query- fallback for natural language search. Useful if the key has not yet been entered into the knowledge base file.data-ai-kb-doc-id- direct ID of the knowledge base document. Use with caution: the document's UUID may change after re-import or in another project.
How to check after loading the MD folder
- Open "Settings" -> "Knowledge Base".
- Find the uploaded document.
- Open editing.
- Check the "Context keys for elements" field.
- Make sure that the values from
data-ai-context-idare there. - If the field is empty, check that the Markdown body contains inline
data-ai-context-id. - Check that the file is active and linked to the agent.
If the link does not work
If a selected button does not find the expected instructions after an MD folder upload:
- Check which
data-ai-context-idis on the button. - Open the corresponding file in the knowledge base.
- Check that the same key is inline
data-ai-context-idinside the document or is already displayed in the "Context keys for elements" field. - Add
data-ai-kb-queryto the button as a text fallback. - Make sure that the agent is connected to a folder or knowledge base file with the "Receive data" right.
If the article is intended for public reading, context keys should not interfere with the text. The visible part of the span should remain a human phrase: "Enter the Telegram token", "Click Connect", "Open the dialog list".
Where this is in the interface
Main elements in this section:
- knowledge base page