From 4959288d5e7c9197af328df691290d9e4cbb6c2c Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Fri, 20 Feb 2026 12:55:14 +0700 Subject: [PATCH 1/2] feat: add Daily Tips API OpenAPI integration and sidebar navigation --- .env.example | 1 + docusaurus.config.ts | 3 ++- src/configs/navbar.ts | 5 +++++ src/configs/openApiPlugins.ts | 8 ++++++++ src/configs/openApiSidebar.ts | 12 ++++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 5820d13..75f76dd 100644 --- a/.env.example +++ b/.env.example @@ -9,6 +9,7 @@ PROJECT_NAME=api-docs CLOUDFLARE_ANALYTICS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxx OPENAPI_DOCS_BLOG_URL=http://${API_DOCS_DOMAIN}:${NGINX_HOST_HTTP_PORT}/blog/openapi.yaml +OPENAPI_DOCS_DAILY_TIPS_URL=http://${API_DOCS_DOMAIN}:${NGINX_HOST_HTTP_PORT}/daily-tips/openapi.yaml #----------------------------------------------------------- #----------------------- Runner --------------------------- diff --git a/docusaurus.config.ts b/docusaurus.config.ts index ff7acb7..5b0ca41 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -4,7 +4,7 @@ import type * as Preset from '@docusaurus/preset-classic'; import Navbar from "./src/configs/navbar"; import PrismConfig from "./src/configs/prism"; import type * as OpenApiPlugin from "docusaurus-plugin-openapi-docs"; -import { CSlantBlogConfig } from "./src/configs/openApiPlugins"; +import { CSlantBlogConfig, CSlantDailyTipsConfig } from "./src/configs/openApiPlugins"; require('dotenv').config(); // This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) @@ -81,6 +81,7 @@ const config: Config = { docsPluginId: "classic", config: { blog: CSlantBlogConfig satisfies OpenApiPlugin.Options, + dailyTips: CSlantDailyTipsConfig satisfies OpenApiPlugin.Options, }, }, ], diff --git a/src/configs/navbar.ts b/src/configs/navbar.ts index b8675eb..301dabe 100644 --- a/src/configs/navbar.ts +++ b/src/configs/navbar.ts @@ -17,6 +17,11 @@ const Navbar = { position: "left", to: "/docs/category/blog-api", }, + { + label: "Daily Tips API", + position: "left", + to: "/docs/category/daily-tips-api", + }, { href: 'https://github.com/cslant', diff --git a/src/configs/openApiPlugins.ts b/src/configs/openApiPlugins.ts index a961bec..ef9fcdc 100644 --- a/src/configs/openApiPlugins.ts +++ b/src/configs/openApiPlugins.ts @@ -5,3 +5,11 @@ export const CSlantBlogConfig = { groupPathsBy: "tag", }, }; + +export const CSlantDailyTipsConfig = { + outputDir: "docs/daily-tips", + specPath: `${process.env.OPENAPI_DOCS_DAILY_TIPS_URL}`, + sidebarOptions: { + groupPathsBy: "tag", + }, +}; diff --git a/src/configs/openApiSidebar.ts b/src/configs/openApiSidebar.ts index ab8a4ce..0d95222 100644 --- a/src/configs/openApiSidebar.ts +++ b/src/configs/openApiSidebar.ts @@ -13,6 +13,18 @@ export const OpenApiSidebar: SidebarsConfig = { slug: '/category/blog-api' }, items: require('../../docs/blog/sidebar.js') + }, + { + type: 'category', + label: 'Daily Tips', + link: { + type: 'generated-index', + title: 'Daily Tips API', + description: + 'CSlant Daily Tips API Documentation uses the OpenAPI Specification to provide a detailed reference for all available endpoints, request and response examples, and more.', + slug: '/category/daily-tips-api' + }, + items: require('../../docs/daily-tips/sidebar.js') } ] }; From 24af2a9bf8d37303094910d45503c499f67da5f0 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Fri, 20 Feb 2026 13:02:14 +0700 Subject: [PATCH 2/2] ci: add GitLab CI pipeline for API docs build process --- gitlab-ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gitlab-ci.yml diff --git a/gitlab-ci.yml b/gitlab-ci.yml new file mode 100644 index 0000000..6b01acf --- /dev/null +++ b/gitlab-ci.yml @@ -0,0 +1,15 @@ +stages: + - build + +variables: + GIT_STRATEGY: none + +build: + stage: build + tags: + - csl2 + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + script: + - cd $API_DOCS_REPO_PATH + - ./runner.sh a