build log
From minimum to decent
Section titled “From minimum to decent”[ ] minimum astro site
[ ] add starlight as docs
[ ] add decapcms as admin
[ ] add spotlight as frontend
1. minimum astro site
Section titled “1. minimum astro site”pnpm create astro@latest Installed astro 5.10.0, and is the only dependency for the project.pnpm ipnpm dev2. add starlight as docs
Section titled “2. add starlight as docs”pnpm astro add starlightthis added starlight 0.34.4, and updated the astro.config.mjs.
now manually revise astro.config.mjs, add an object with title and sidebar fields in the starlight() integrations.
starlight({ title: "Docs - From Minimum To Decent", })config content configuration(add src/content.config.ts and src/content/docs folder):
import { defineCollection } from 'astro:content';import { docsLoader } from '@astrojs/starlight/loaders';import { docsSchema } from '@astrojs/starlight/schema';export const collections = { docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),};add content in src/content/docs/docs/index.md
note: there are 2 docs in this path, this is needed for current starlight structure.
---title: My docsdescription: Learn more about my project in this docs site built with Starlight.---Welcome to my project!now check http://localhost:4321/docs
To update starlight and other Astro packages:
pnpm dlx @astrojs/upgrade
you can run pnpm create astro --template starlight to get here(include step 1 and step 2 here).
3. astro-decap-cms-oauth
Section titled “3. astro-decap-cms-oauth”https://github.com/dorukgezici/astro-decap-cms-oauth
add oauth app on github settings.
Client ID
Client secrets
create new repo on github:
create new repo on gitee:
both are private repos.
git initgit config user.name "xxx"git config user.email "xxx@xxx.com"git remote add origin https://gitee.com/xxx/xxx.gitgit add .git commit -m "first commit"revise git config file get github token mirror gitee and github
git push -u origin "master"add domain on cloudflare add pages from github as astro app. OAUTH_GITHUB_CLIENT_ID= OAUTH_GITHUB_CLIENT_SECRET=
pnpm astro add astro-decap-cms-oauthinstalled astro-decap-cms-oauth 0.5.1
default decapcmsoauth config:
{ decapCMSSrcUrl: "", decapCMSVersion: "3.3.3", adminDisabled: false, adminRoute: "/admin", oauthDisabled: false, oauthLoginRoute: "/oauth", oauthCallbackRoute: "/oauth/callback",}put this in the decapCmsOauth() in astro.config.mjs if not in the default setting.
add public/admin/config.yml
backend: name: github branch: master # change this to your branch repo: jackymao/www821118cn # change this to your repo squash_merges: true site_domain: www.821118.cn # change this to your domain base_url: https://www.821118.cn # change this to your prod URL auth_endpoint: oauth # the oauth route provided by the integrationpublish_mode: editorial_workflowmedia_folder: "src/assets/decapimages" # Location where files will be stored in the repopublic_folder: "src/assets/decapimages" # The src attribute for uploaded mediacollections:- name: "docs" # Used in routes, e.g., /admin/collections/docs label: "Docs" # Used in the UI folder: "src/content/docs/docs" # The path to the folder where the documents are stored create: true # Allow users to create new documents in this collection slug: '{{slug}}' fields: # The fields for each document, usually in frontmatter- { label: "Title", name: "title", widget: "string" }- { label: "Draft", name: "draft", widget: "boolean", default: true }- { label: "Publish Date", name: "pubDate", widget: "datetime", default: "{{now}}" }- { label: "Featured Image", name: "thumbnail", widget: "image", required: false }- { label: "Rating (scale of 1-5)", name: "rating", widget: "number", required: false }- { label: "Body", name: "body", widget: "markdown", hint: "Main content goes here." }# - name: "posts" # Used in routes, e.g., /admin/collections/posts# label: "Posts" # Used in the UI# folder: "src/content/posts" # The path to the folder where the documents are stored# create: true # Allow users to create new documents in this collection# slug: '{{slug}}'# fields: # The fields for each document, usually in frontmatter# - { label: "Title", name: "title", widget: "string" }# - { label: "Description", name: "description", widget: "string" }# - { label: "Publish Date", name: "pubDate", widget: "datetime" }# - { label: "Banner", name: "banner", widget: "image" }# - { label: "Category", name: "category", widget: "string" }# - { label: "Tags", name: "tags", widget: "list", allow_add: true}# - { label: "Body", name: "body", widget: "markdown" }https://decapcms.org/docs/editorial-workflows/
https://github.com/decaporg/decap-cms/blob/main/dev-test/config.yml
pnpm astro add cloudflaregit add . ; git commit -m "try 1 on adding astro-decap-cms-oauth" ; git push