依網站設定
為工作區中的每個網站分別啟用並設定公開 API。
依網站設定的公開 API,精確控制要公開什麼、對誰公開。在任何地方都以同樣可預期的 JSON 結構擷取已發布內容、sitemap 與重新導向——不必學 GraphQL 結構描述,也不必維護自動生成的用戶端。以下每個請求都是真實的:一個建構在 CMSHub 上的部落格,只用 curl 呼叫。
網站一旦啟用並將某個集合列入允許清單,只要一個簡單的 GET 就能取得其已發布記錄——完全依 Host 標頭解析,公開資料不需要 API 金鑰。
https://the-signal.blog/api/postscurl https://the-signal.blog/api/posts{
"siteId": "the-signal-4f2a",
"siteName": "The Signal",
"baseUrl": "https://the-signal.blog",
"collection": {
"id": "3b0d6f2a-9c41-4e8a-8f2e-1d4c9a7b6e11",
"slug": "posts",
"name": "Posts"
},
"data": [
{
"id": "a91f2e3c-7d5b-4a10-9c3e-6f8a2b1d0e44",
"locale": "en",
"translationOfId": null,
"data": {
"title": "Shipping a public content API without a GraphQL schema",
"slug": "shipping-a-public-content-api",
"excerpt": "Plain REST beats a bespoke query language when a frontend just needs JSON.",
"category": "Engineering",
"author": "Dana Osei",
"published_at": "2026-09-10"
}
},
{
"id": "d2c5b8a1-4e3f-4c9d-8b7a-2f1e6d5c4b33",
"locale": "en",
"translationOfId": null,
"data": {
"title": "What the quality gate actually checks before you publish",
"slug": "the-quality-gate-explained",
"excerpt": "Every generated page passes the same checks, whether it's post 1 or post 10,000.",
"category": "Product",
"author": "Dana Osei",
"published_at": "2026-09-04"
}
}
],
"meta": {
"locale": "en",
"pagination": { "start": 0, "limit": 20, "total": 2, "nextCursor": null }
}
}sitemap.xml 與 robots.txt 由內容 API 讀取的同一份頁面清單生成——沒有另外的設定需要同步,也沒有任何東西需要手動重新生成。
https://the-signal.blog/sitemap.xmlcurl https://the-signal.blog/sitemap.xml<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url><loc>https://the-signal.blog/posts/shipping-a-public-content-api</loc><lastmod>2026-09-10T14:22:00.000Z</lastmod></url>
<url><loc>https://the-signal.blog/posts/the-quality-gate-explained</loc><lastmod>2026-09-04T09:15:00.000Z</lastmod></url>
</urlset>在你明確設定網站要公開哪些內容之前,公開內容 API 一律保持關閉——不存在預設開放、悄悄提供未發布或草稿內容的端點。
為工作區中的每個網站分別啟用並設定公開 API。
公開 API 只提供通過品質關卡、確實已發布的內容——絕不提供草稿。
每個路由都位於版本化路徑下,今天打造的整合,在 CMSHub 演進後依然可用。