<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sanity &#8211; iAIFeed</title>
	<atom:link href="https://www.iaifeed.com/tag/sanity/feed" rel="self" type="application/rss+xml" />
	<link>https://www.iaifeed.com</link>
	<description>iAIFeed</description>
	<lastBuildDate>Thu, 22 Oct 2026 12:41:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>

<image>
	<url>https://www.iaifeed.com/wp-content/uploads/2026/07/cropped-iaifeed1-80x80.png</url>
	<title>sanity &#8211; iAIFeed</title>
	<link>https://www.iaifeed.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Query Sanity Content With GROQ for a Faster Front End</title>
		<link>https://www.iaifeed.com/how-to-query-sanity-content-with-groq</link>
					<comments>https://www.iaifeed.com/how-to-query-sanity-content-with-groq#respond</comments>
		
		<dc:creator><![CDATA[iamltlb]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 12:41:51 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[sanity]]></category>
		<guid isPermaLink="false">https://www.iaifeed.com/how-to-query-sanity-content-with-groq</guid>

					<description><![CDATA[GROQ beats REST for nested content. Here is how to write joins, projections and filters in Sanity, plus the caching layer that keeps you under the CDN quota.]]></description>
										<content:encoded><![CDATA[<p>GROQ is <a href="https://www.iaifeed.com/ai-tool/sanity">Sanity</a>&#8216;s query language. A single GROQ query can return a post, its author, and its category names in one request, which is why most teams stop using REST-style expansion after week one. Queries run against the CDN endpoint for published content and the live endpoint for drafts.</p>
<p>The speed difference is real but not magic. You save round trips, not database work. Fetching a list of 20 posts with authors via GROQ is one HTTP call instead of 21.</p>
<h2 id="what-does-a-basic-groq-query-look-like">What Does a Basic GROQ Query Look Like?</h2>
<p>Start with the document selector, then parentheses, then a projection.</p>
<pre><code>*[_type == &quot;post&quot;] | order(publishedAt desc)[0...10]{
  title,
  &quot;slug&quot;: slug.current,
  publishedAt,
  &quot;authorName&quot;: author-&gt;name
}
</code></pre>
<p>Three things to notice. The brackets filter documents, the pipe operators sort and paginate, and the braces define what you actually want back. Anything not listed in the braces never crosses the wire.</p>
<h2 id="how-do-i-join-related-documents-in-one-query">How Do I Join Related Documents in One Query?</h2>
<p>Use the arrow operator — <code>author-&gt;name</code> follows a reference and reads a field on the target document. This is the piece REST cannot do without extra requests.</p>
<table>
<thead>
<tr>
<th>Task</th>
<th>GROQ</th>
<th>Cost</th>
</tr>
</thead>
<tbody>
<tr>
<td>Follow one reference</td>
<td><code>author-&gt;name</code></td>
<td>Free, same query</td>
</tr>
<tr>
<td>Nested reference</td>
<td><code>author-&gt;company-&gt;name</code></td>
<td>Free, same query</td>
</tr>
<tr>
<td>Count children</td>
<td><code>count(*[_type=="comment" &amp;&amp; post._ref == ^._id])</code></td>
<td>Extra scan</td>
</tr>
<tr>
<td>Reverse lookup</td>
<td><code>*[_type=="post" &amp;&amp; references(^._id)]</code></td>
<td>Extra scan</td>
</tr>
</tbody>
</table>
<p>That last pattern is how you get &#8220;all posts tagged with this topic&#8221; from a topic document. <code>references()</code> is a filter, not a join, so it scans documents — fine at a few thousand docs, painful at a hundred thousand.</p>
<h2 id="how-do-i-filter-and-paginate-without-breaking-sorting">How Do I Filter and Paginate Without Breaking Sorting?</h2>
<p>Ordering and slicing always go in the pipe section, after the filter:</p>
<ul>
<li><code>*[_type == "post" &amp;&amp; defined(slug.current)]</code> — skip drafts with no slug.</li>
<li><code>| order(_createdAt desc)</code> — newest first; <code>_createdAt</code> is set by the system, so it always exists.</li>
<li><code>| order(publishedAt desc)[0...12]</code> — page one. For page two use <code>[12...24]</code>.</li>
</ul>
<p>Offset pagination drifts when editors publish between page loads. If that matters, cursor on a stable field: <code>*[_type=="post" &amp;&amp; publishedAt &lt; $cursor]</code> and pass the last item&#8217;s timestamp as a parameter.</p>
<h2 id="why-is-my-query-slow-or-capped">Why Is My Query Slow or Capped?</h2>
<p>Two usual suspects. First, querying the live API instead of the CDN: live is uncached and costs more units. Swap <code>api.sanity.io</code> for <code>apicdn.sanity.io</code> and published reads drop to near-instant.</p>
<p>Second, unbounded array projections. <code>body</code> on a long post can be 200 KB of portable text. Add <code>body[]{_type, children[0...1]}</code> or simply omit <code>body</code> from list queries and fetch it only on the detail page.</p>
<p>Sanity meters API requests on the free plan at 100,000 per month — 2,000 requests for a list view costs 2,000 units, and a misconfigured client component re-rendering on every keystroke gets there in a week.</p>
<h2 id="how-should-i-cache-groq-results-in-nextjs-or-astro">How Should I Cache GROQ Results in Next.js or Astro?</h2>
<p>Use incremental static regeneration with a tag-based revalidation webhook. In Next.js App Router, fetch with <code>{ next: { tags: ['post'], revalidate: 3600 } }</code> and have a Sanity webhook hit your <code>/api/revalidate</code> route on publish. Pages stay static, content updates within seconds of publishing.</p>
<p>Astro users get the same with <code>getStaticPaths</code> plus a redeploy hook, but a full rebuild on every publish stops scaling past a few hundred pages.</p>
<h2 id="who-should-not-bother-with-groq">Who Should Not Bother With GROQ?</h2>
<p>If your content model is flat — one page type, no references — plain <code>fetch()</code> against the REST export is simpler and nobody on the team has to learn a query language. GROQ pays off specifically when content is relational. Teams that copy a 15-line GROQ query without understanding the arrow operator end up debugging empty arrays for an afternoon.</p>
<h2 id="quick-summary">Quick Summary</h2>
<ul>
<li>GROQ returns nested references in one request using the <code>-&gt;</code> operator.</li>
<li>Projections limit payload size — list queries should not include the full body.</li>
<li>Query <code>apicdn.sanity.io</code> for published content; the live API is uncached.</li>
<li>Offset pagination drifts; use cursor pagination for feeds.</li>
<li>The free plan allows 100,000 API requests per month, so cache aggressively.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.iaifeed.com/how-to-query-sanity-content-with-groq/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Set Up Sanity Studio and Publish Your First Content in 2026</title>
		<link>https://www.iaifeed.com/how-to-set-up-sanity-studio-and-publish-content</link>
					<comments>https://www.iaifeed.com/how-to-set-up-sanity-studio-and-publish-content#respond</comments>
		
		<dc:creator><![CDATA[iamltlb]]></dc:creator>
		<pubDate>Thu, 22 Oct 2026 12:41:27 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[sanity]]></category>
		<guid isPermaLink="false">https://www.iaifeed.com/how-to-set-up-sanity-studio-and-publish-content</guid>

					<description><![CDATA[Install Sanity Studio, connect a dataset, and publish your first document in under 20 minutes. Includes the free-tier limits and the mistakes that break deploys.]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.iaifeed.com/ai-tool/sanity">Sanity</a> Studio is a React app you run locally and deploy yourself; it talks to a hosted Content Lake dataset over the API. Setup takes about 20 minutes: <code>npm create sanity@latest</code>, log in, pick a project name, then add your first schema and publish.</p>
<p><a href="https://www.iaifeed.com/ai-tool/sanity">Sanity</a> is a headless CMS, not a website builder. That distinction matters more than any feature list. You get a database with a query API and an editing UI, and you still have to build the front end. If you want a CMS that ships pages for you, this is the wrong tool.</p>
<h2 id="what-is-sanity-and-what-does-it-actually-give-you">What Is Sanity and What Does It Actually Give You?</h2>
<p>Sanity is a content platform made of three parts: the Content Lake (hosted document database queried with GROQ), the Studio (open-source React editor you host), and the Asset Pipeline for images and files. Content lives as JSON documents. No rendered pages, no themes.</p>
<p>The free plan includes 10 GB of assets, 100,000 API requests per month, and two datasets. That covers a small blog or a marketing site comfortably. A content-heavy site with 50 editors will hit the request quota, and the next tier is usage-based, so budget it before you commit.</p>
<h2 id="how-do-i-install-sanity-studio-step-by-step">How Do I Install Sanity Studio Step by Step?</h2>
<p>You need Node.js 20 or newer. Then run these commands in a terminal.</p>
<ol>
<li><code>npm create sanity@latest</code> — scaffolds <code>studio/</code> with a project name you type in.</li>
<li>Choose the dataset name (<code>production</code> is the default) and confirm the schema template (&#8220;Clean project with no predefined schemas&#8221;).</li>
<li>Log in through the browser window that opens. Google, GitHub, or email all work.</li>
<li><code>cd studio &amp;&amp; npm run dev</code> — the Studio starts on <code>http://localhost:3333</code>.</li>
</ol>
<p>If <code>npm create</code> hangs on a proxy, set <code>npm config set proxy</code> and <code>npm config set https-proxy</code> first. That failure mode looks like a frozen install but is really a network block.</p>
<h2 id="how-do-i-define-a-schema-and-add-fields">How Do I Define a Schema and Add Fields?</h2>
<p>Schemas live in <code>schemaTypes/</code>. Create <code>post.ts</code> with a <code>defineType</code> call:</p>
<pre><code>export default defineType({
  name: 'post',
  title: 'Post',
  type: 'document',
  fields: [
    defineField({ name: 'title', type: 'string', validation: r =&gt; r.required() }),
    defineField({ name: 'slug', type: 'slug', options: { source: 'title' } }),
    defineField({ name: 'body', type: 'array', of: [{ type: 'block' }] }),
  ],
})
</code></pre>
<p>Register it in <code>schemaTypes/index.ts</code>, save, and the Studio hot-reloads with a &#8220;Post&#8221; item in the sidebar. The <code>slug</code> type auto-generates from the title when you click Generate, which saves you from writing a slugify function.</p>
<h2 id="how-do-i-publish-content-and-query-it-from-my-front-end">How Do I Publish Content and Query It From My Front End?</h2>
<p>Click the pencil icon, create a Post document, fill in the title and body, then hit Publish. Drafts autosave every few seconds; Publish is what makes the document visible to the API.</p>
<p>Query it with GROQ over the CDN endpoint:</p>
<pre><code>https://YOUR_PROJECT_ID.api.sanity.io/v2024-10-01/data/query/production?query=*[_type==&quot;post&quot;]{title,slug}
</code></pre>
<p>Add your project ID to <code>.env</code> as <code>SANITY_PROJECT_ID</code> rather than hardcoding it. If a query returns an empty array while the Studio clearly shows content, you almost certainly queried the wrong dataset name or forgot <code>_type</code>.</p>
<h2 id="how-do-i-deploy-sanity-studio-for-a-team">How Do I Deploy Sanity Studio for a Team?</h2>
<p>Run <code>npx sanity deploy</code>. It asks for a hostname and publishes the Studio to <code>your-name.sanity.studio</code>. Your editors get a real URL and never touch Git.</p>
<p>The tradeoff is that every schema change needs a redeploy, so batch schema edits. Also remember the deployed Studio is public by default — turn on the project&#8217;s member roles before you share the link with outside writers.</p>
<h2 id="is-sanity-free-and-who-should-skip-it">Is Sanity Free, and Who Should Skip It?</h2>
<p>Free tier: 10 GB assets, 100k API requests/month, 2 datasets, 3 users. Pricing beyond that is per-seat plus usage, and costs climb faster than a flat WordPress host once you add a dozen editors.</p>
<p>Skip Sanity if you want a working blog today with zero front-end work, or if your team only edits long-form pages and has no developer. Sanity earns its place when content gets reused across a website, a mobile app, and a docs site, because one document feeds all three.</p>
<h2 id="quick-summary">Quick Summary</h2>
<ul>
<li>Sanity Studio is a React editor you install locally and deploy with <code>npx sanity deploy</code>; content sits in the hosted Content Lake.</li>
<li>Setup is four commands plus one schema file; you need Node.js 20+.</li>
<li>The free plan gives 10 GB assets and 100,000 API requests per month.</li>
<li>You must build your own front end — Sanity renders nothing for you.</li>
<li>Query the CDN API endpoint, not the write endpoint, for public reads.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.iaifeed.com/how-to-set-up-sanity-studio-and-publish-content/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
