79 lines
3.7 KiB
Markdown
79 lines
3.7 KiB
Markdown
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
|
|
|
## Getting Started
|
|
|
|
First, run the development server:
|
|
|
|
```bash
|
|
npm run dev
|
|
# or
|
|
yarn dev
|
|
# or
|
|
pnpm dev
|
|
# or
|
|
bun dev
|
|
```
|
|
|
|
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
|
|
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
|
|
|
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
|
|
|
## CMS SEO and Publish Cache
|
|
|
|
CMS routes read custom SEO title/description (falling back to standard Wagtail
|
|
SEO fields), canonical URL, social image, and JSON-LD. Explicit CMS SEO titles
|
|
are output without appending the site title template. Empty JSON-LD is omitted,
|
|
and script boundaries are escaped before output.
|
|
|
|
Deploy the backend API changes first, then build and restart the frontend.
|
|
No database migrations are required. Set `NEXT_PUBLIC_API_URL` to the public
|
|
CMS origin before building the frontend.
|
|
|
|
Set backend `FRONTEND_REVALIDATE_URL` to the frontend `/api/revalidate` endpoint.
|
|
Both services must use the same `REVALIDATE_SECRET`. All Wagtail page requests
|
|
share the `wagtail-pages` tag. Publishing expires this tag immediately, and the
|
|
next request fetches fresh data. This refreshes all page caches, including lists.
|
|
Snippet caches retain separate tags. Without a working webhook, the existing
|
|
60-second time-based revalidation remains the fallback.
|
|
|
|
Frontend tests: `node --test tests/seo.test.cjs`.
|
|
Backend tests (from the backend root):
|
|
`python -m pytest apps/core/tests.py -k "page_api_exposes_seo_fields or seo_image_serializer or notify_frontend_revalidate"`.
|
|
|
|
## CMS Display Fields
|
|
|
|
Products, solutions, cases and blog columns display the CMS title and introduction.
|
|
Lists and detail pages display optional cover images, summaries, industry/client
|
|
details, publication dates (Asia/Shanghai) and blog tags where applicable. Missing
|
|
images and optional fields are omitted. Detail previews request the same fields.
|
|
|
|
The footer reads the `footer` navigation menu and site settings for contact details,
|
|
WeChat account/QR code and Weibo link. An unconfigured menu falls back to the privacy
|
|
policy link; the existing ICP fallback is retained. Feature-grid icons follow the
|
|
same text-symbol convention as tech-stack icons.
|
|
|
|
Deploy the backend field declarations before rebuilding the frontend. These changes
|
|
use existing database fields and require no new migrations. Page publication uses
|
|
the shared cache tag; menu/site-setting changes retain the 60-second cache fallback.
|
|
|
|
Display/API regression tests (from the backend root):
|
|
`python -m pytest apps/blog/tests.py apps/products/tests.py apps/solutions/tests.py apps/cases/tests.py`.
|
|
Frontend display regressions run alongside SEO tests: `node --test tests/seo.test.cjs`.
|
|
|
|
## Learn More
|
|
|
|
To learn more about Next.js, take a look at the following resources:
|
|
|
|
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
|
|
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
|
|
|
## Deploy on Vercel
|
|
|
|
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
|
|
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|