LLM Optimization for websites: search and prompting
How do you optimize your website for AI? In this blog we are going to discuss how to optimize a website for AI. Now that traditional search engines are on the rapid decline as AI Chat "ask and you will be given" starts to rise, we here at Talkr started to optimize for LLM's. Instead of ignoring it, we want AI to be able to interface with our website as best as possible. So we started to focus on LLM optimization. What does optimizing for LLM's mean? Optimization for LLM is the newest form of website optimization that let machines read content in other ways that search engines do. For example, LLM's like Chat GPT prefers JSON format over raw HTML. It likes snippets and short summaries over large bodies of text, as this optimizes memory usage of the LLM, and might give priority by the LL models as it is less resource intensive. We like to explain how we optimized our website for LLM discovery and machine exchange, a summary of how you can optimize your website for AI and LLM's.
JSON-LD
What is JSON LD? JSON-LD helps search engines understand the meaning of your content by embedding structured data directly into the HTML of a web page. Google, Microsoft, Pinterest, Yandex and others already use these vocabularies to power rich, extensible experiences. First we create a LD+JSON summary on every page on Talkr. An example that uses schema.org
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Talkr",
"url": "https://talkr.app",
"description": "A calm space for micro-creators to blog thoughts, music, code, and more — without the noise of big platforms.",
"publisher": {
"@type": "Organization",
"name": "Talkr",
"url": "https://talkr.app",
"logo": {
"@type": "ImageObject",
"url": "/icon-512x512.png"
}
}
}
</script>
This LD JSON is found on all pages and profiles on Talkr, customized for each user profile. It gives machines a summary of what the page is about without the need to crawl all HTML and parse it, as the latter does not give a guarantee that it will be able to understand the page and it's optimization. We found LD JSON to be crucial at Talkr for LLM's to better understand our pages.
LLM Feed
In addition to the JSON LD, we generated a specific feed for the LLM's to crawl. In our case it was a PHP file that fetches all posts and profiles and makes them machine readable through JSON. We included the llm feed on our homepage, so that LLM crawlers have access to it and can process the data accordingly. The LLM feed has short summaries of a maximum of 280 characters:
<link rel="alternate" type="application/json" title="LLM Feed" href="/llm-feed.php" />
The LLM feed can be viewed here: https://talkr.app/llm-feed.php
LLM Plugin
Furthermore, to let LLM's autodiscover our site as a plugin, we created a plugin.json in the .well-known directory, that LLM crawlers can access and understand:
.well-known/ai-plugin.json
.well-known/openapi.yaml
Plugin code
{
"schema_version": "v1",
"name_for_human": "Talkr",
"name_for_model": "talkr",
"description_for_human": "Read and summarize public microblogs from Talkr.",
"description_for_model": "Fetch recent posts and summaries from talkr.app's public LLM feed.",
"auth": {
"type": "none"
},
"api": {
"type": "openapi",
"url": "https://talkr.app/.well-known/openapi.yaml"
},
"logo_url": "https://talkr.app/resources/icons/icon-512x512.png",
"contact_email": "redacted@talkr.app",
"legal_info_url": "https://talkr.app/terms.html"
}
Then we created a .well-known/openapi.yaml, referenced inside the ai-plugin, which is a public OpenAPI spec that outlines the structure and purpose of the llm-feed.php endpoint. This enables direct integration with LLM agents, including developer tools!
Summary snippets for LLM's
Further optimization can be done by generating short LLM snippets on each page inside a hidden div. For example this div element reflects our description and title, consolidating to LLM's what the page is about and further increase discovery and optimization;
<div class="llm-summary" style="display:none;">
Talkr is a minimalist blogging platform where you come first, not algorithms. It's a space to write, share, and connect. If you are looking for a x, twitter, bluesky, facebook or substack alternative, Talkr.app is the place for you.
</div>
Robots.txt
Next to that, we also updated our robot.txt so that robots give priority to the sitemap.xml and LLM feed:
User-agent: *
Allow: /
Sitemap: https://talkr.app/sitemap.xml
Allow: /llm-feed.php
Open Graph
LLM's love Open Graph, because the og properties does a near perfect summarization of what a page is about. In our case we did additional optimization for the LLM's, such as ChatGPT. It is therefore important to add this to a website.
<meta property="og:type" content="website">
<meta property="og:url" content="https://talkr.app">
<meta property="og:site_name" content="Talkr">
<meta property="og:title" content="Talkr - write something beautiful. Join the conversation on Talkr, a fast, clean blogging app." />
<meta property="og:description" content="See what's new on Talkr." />
<meta property="og:image" content="/twitter-image.png" />
By doing this we are one of the first social media platforms that interfaces with LLM's and generate specific optimization for LLM's. Search engines and AI tools can now directly understand and fetch Talkr posts, which means better visibility, richer summaries, and future integration with AI agents.
Talkr is now AI ready!