This repository serves as the headless CMS/Database for the Chintaporadh article website. It follows a Git-CMS architecture.
global.json: The central index of all articles. Contains summary data for listing articles on the frontend.articles/{UID}/: Individual article folders.content.md: The article body in Markdown.metadata.json: Detailed metadata for the specific article.images/: Assets related to the article.
To fetch content in your frontend application, use a CDN service like jsDelivr.
Base URL:
https://cdn.jsdelivr.net/gh/{GITHUB_USERNAME}/{REPO_NAME}@main
Examples:
- Fetch Global Index:
https://cdn.jsdelivr.net/gh/user/repo@main/global.json - Fetch Article Cover:
https://cdn.jsdelivr.net/gh/user/repo@main/articles/cJjpTZsYwk_9/images/cover.png - Fetch Article Content:
https://cdn.jsdelivr.net/gh/user/repo@main/articles/cJjpTZsYwk_9/content.md
To manage content programmatically (Admin Panel), use the GitHub REST API.
Endpoint: https://api.github.com/repos/{OWNER}/{REPO}/contents/{PATH}
Authentication:
- Requires a Personal Access Token (PAT) or OAuth token with
reposcope.
Workflow:
- Read: GET request to the file path to retrieve
shaandcontent(base64 encoded). - Update: PUT request to the file path with updated content (base64) and the correct
sha. - Create: PUT request to a new path.
- Delete: DELETE request.
- Generate a unique ID (NanoID 12 chars recommended).
- Create folder
articles/{UID}. - Add
content.mdandmetadata.json. - Update
global.jsonwith the new entry. - Commit and Push.