> ## Documentation Index
> Fetch the complete documentation index at: https://thestacc.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Going to production

> Fetching at build time means new posts only appear when your site rebuilds.

## Keeping your site up to date with Deploy Hooks

Fetching at build time means new posts only appear when your site rebuilds. You don't want to trigger that by hand every time. A **deploy hook** does it for you: theStacc sends a request to your hosting platform whenever a post is **published** or **unpublished**, which kicks off a fresh build that pulls in the latest content.

You'll find the **Deploy Hook** field right below your API key, under **Content > Settings > Publishing > API Access**. Paste the deploy hook URL from your Cloudflare Pages, Vercel, or Netlify dashboard, click **Save**, then click **Test** to confirm it triggers a build. The URL must be an HTTPS URL.

For the full walkthrough — getting the URL from each platform, GitHub Pages via GitHub Actions, and troubleshooting — see [Deploy Hooks](/docs/developers/deploy-hooks).

## Generating a sitemap

A sitemap helps Google discover and re-crawl your posts. The Public Blog API has a dedicated, lightweight endpoint built for exactly this:

```
GET https://api.thestacc.com/blog/api/v1/public/blogs/sitemap?api_key=YOUR_API_KEY
```

It returns only `slug`, `published_at`, and `updated_at` for every published post (up to 5,000 posts), so it's fast and cheap to call during a build. Loop over the results to emit `<url>` entries for your `sitemap.xml`, mapping `updated_at` to `<lastmod>`. Full response shape is in the [Public Blog API sitemap reference](/docs/developers/public-blog-api#get-blog-sitemap-data).

If your generator already produces a sitemap that includes your blog routes (such as `@astrojs/sitemap`), you don't need to call this endpoint separately — the blog pages are picked up automatically because they're static routes.

## Testing locally

Run your site locally with the environment variables set, then verify:

1. The blog listing page shows all published blogs
2. Each blog detail page renders content correctly
3. Images load properly
4. Meta tags are set (check with **View Source**)
5. Internal links within blog content work and point to real, published posts
6. A non-existent slug returns your 404 page (not a crash)
7. The build fails cleanly if you set a wrong API key — confirming your error handling works

## Next steps

* Review the [Public Blog API](/docs/developers/public-blog-api) reference for every endpoint, parameter, default, and limit
* Set up [Deploy Hooks](/docs/developers/deploy-hooks) so your site rebuilds automatically when blogs are published
* Add an XML sitemap for SEO using the [sitemap endpoint](/docs/developers/public-blog-api#get-blog-sitemap-data)
