chore: remove domain references
This commit is contained in:
parent
fce4c8e2ff
commit
581d7c64a3
@ -99,9 +99,8 @@ In order to debug a specific issue follow the next steps:
|
||||
1. Replace `dev-test/config.yml` with the relevant `config.yml`. If you want to test the backend, make sure that the `backend` property of the config indicates which backend you use (Github, Gitlab, Bitbucket etc) and path to the repo.
|
||||
|
||||
```js
|
||||
backend:
|
||||
name: github
|
||||
repo: owner-name/repo-name
|
||||
backend: name: github;
|
||||
repo: owner - name / repo - name;
|
||||
```
|
||||
|
||||
2. Run `yarn dev`
|
||||
@ -111,7 +110,7 @@ backend:
|
||||
|
||||
When debugging the CMS with Git Gateway you must:
|
||||
|
||||
1. Have a Netlify site with [Git Gateway](https://docs.netlify.com/visitor-access/git-gateway/) and [Netlify Identity](https://docs.netlify.com/visitor-access/identity/) enabled. An easy way to create such a site is to use a [template](https://staticcms.org/docs/start-with-a-template/), for example the [Gatsby template](https://app.netlify.com/start/deploy?repository=https://github.com/AustinGreen/gatsby-starter-netlify-cms&stack=cms)
|
||||
1. Have a Netlify site with [Git Gateway](https://docs.netlify.com/visitor-access/git-gateway/) and [Netlify Identity](https://docs.netlify.com/visitor-access/identity/) enabled. An easy way to create such a site is to use a [template](https://staticjscms.netlify.app/docs/start-with-a-template/), for example the [Gatsby template](https://app.netlify.com/start/deploy?repository=https://github.com/AustinGreen/gatsby-starter-netlify-cms&stack=cms)
|
||||
2. Tell the CMS the URL of your Netlify site using a local storage item. To do so:
|
||||
|
||||
1. Open `http://localhost:8080/` in the browser
|
||||
|
41
README.md
41
README.md
@ -6,10 +6,11 @@
|
||||
[![npm latest package](https://img.shields.io/npm/v/@staticcms/core/latest.svg)](https://www.npmjs.com/package/@staticcms/core)
|
||||
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/StaticJsCMS/static-cms/blob/main/CONTRIBUTING.md)
|
||||
[![All Contributors](https://img.shields.io/github/all-contributors/StaticJsCMS/static-cms?color=ee8449&style=flat-square)](#contributors)
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Docs](https://staticcms.org/)
|
||||
| [Demo](https://demo.staticcms.org/)
|
||||
[Docs](https://staticjscms.netlify.app/)
|
||||
| [Demo](https://demo-staticjscms.netlify.app/)
|
||||
| [Issues](https://github.com/StaticJsCMS/static-cms/issues)
|
||||
| [Discord](https://discord.gg/ZWJM9pBMjj)
|
||||
|
||||
@ -28,41 +29,41 @@ You setup a YAML config to describe the content model of your site, and typicall
|
||||
|
||||
When a user navigates to `/admin/` they'll be prompted to log in, and once authenticated they'll be able to create new content or edit existing content.
|
||||
|
||||
Read more about Static CMS [Core Concepts](https://staticcms.org/docs/intro/).
|
||||
Read more about Static CMS [Core Concepts](https://staticjscms.netlify.app/docs/intro/).
|
||||
|
||||
# Installation and Configuration
|
||||
|
||||
The Static CMS can be used in two different ways.
|
||||
|
||||
- A Quick and easy install, that requires you to create a single HTML file and a configuration file. All the CMS JavaScript and CSS are loaded from a CDN.
|
||||
To learn more about this installation method, refer to the [CDN Hosting Guide](https://staticcms.org/docs/add-to-your-site-cdn/)
|
||||
To learn more about this installation method, refer to the [CDN Hosting Guide](https://staticjscms.netlify.app/docs/add-to-your-site-cdn/)
|
||||
- A complete, more complex install, that gives you more flexibility but requires that you use a static site builder with a build system that supports npm packages.
|
||||
To learn more about this installation method, refer to the [Bundling Guide](https://staticcms.org/docs/add-to-your-site-bundling/)
|
||||
To learn more about this installation method, refer to the [Bundling Guide](https://staticjscms.netlify.app/docs/add-to-your-site-bundling/)
|
||||
|
||||
# Projects
|
||||
|
||||
|Name|Site/Demo|Status|Beta|
|
||||
|---|---|---|---|
|
||||
| [@staticcms/core](https://github.com/StaticJsCMS/static-cms/tree/main/packages/core) | [demo.staticcms.org](https://demo.staticcms.org/) | [![Build](https://github.com/StaticJsCMS/static-cms/actions/workflows/build.yml/badge.svg)](https://github.com/StaticJsCMS/static-cms/actions/workflows/build.yml) [![npm latest package](https://img.shields.io/npm/v/@staticcms/core/latest.svg)](https://www.npmjs.com/package/@staticcms/core) | [![npm next package](https://img.shields.io/npm/v/@staticcms/core/next.svg)](https://www.npmjs.com/package/@staticcms/core/v/next) |
|
||||
| [@staticcms/app](https://github.com/StaticJsCMS/static-cms/tree/main/packages/app) | [demo.staticcms.org](https://demo.staticcms.org/) | [![Build](https://github.com/StaticJsCMS/static-cms/actions/workflows/build.yml/badge.svg)](https://github.com/StaticJsCMS/static-cms/actions/workflows/build.yml) [![npm latest package](https://img.shields.io/npm/v/@staticcms/app/latest.svg)](https://www.npmjs.com/package/@staticcms/app) | [![npm next package](https://img.shields.io/npm/v/@staticcms/app/next.svg)](https://www.npmjs.com/package/@staticcms/app/v/next) |
|
||||
| [demo](https://github.com/StaticJsCMS/static-cms/tree/main/packages/demo) | [demo.staticcms.org](https://demo.staticcms.org/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/8c1b73b5-d348-45cd-be2a-7af84be5541f/deploy-status)](https://app.netlify.com/sites/demo-staticjscms/deploys) | [Beta Demo](https://next.demo.staticcms.org/) |
|
||||
| [docs](https://github.com/StaticJsCMS/static-cms/tree/main/packages/docs) | [staticcms.org](https://www.staticcms.org/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/91f6eeb2-f1ed-4e4e-bdd1-f5c6bd01ccd5/deploy-status)](https://app.netlify.com/sites/staticjscms/deploys) | [Beta Docs](https://next.staticcms.org/) |
|
||||
| Name | Site/Demo | Status |
|
||||
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [@staticcms/core](https://github.com/StaticJsCMS/static-cms/tree/main/packages/core) | [demo-staticjscms.netlify.app](https://demo-staticjscms.netlify.app/) | [![Build](https://github.com/StaticJsCMS/static-cms/actions/workflows/build.yml/badge.svg)](https://github.com/StaticJsCMS/static-cms/actions/workflows/build.yml) [![npm latest package](https://img.shields.io/npm/v/@staticcms/core/latest.svg)](https://www.npmjs.com/package/@staticcms/core) |
|
||||
| [@staticcms/app](https://github.com/StaticJsCMS/static-cms/tree/main/packages/app) | [demo-staticjscms.netlify.app](https://demo-staticjscms.netlify.app/) | [![Build](https://github.com/StaticJsCMS/static-cms/actions/workflows/build.yml/badge.svg)](https://github.com/StaticJsCMS/static-cms/actions/workflows/build.yml) [![npm latest package](https://img.shields.io/npm/v/@staticcms/app/latest.svg)](https://www.npmjs.com/package/@staticcms/app) |
|
||||
| [demo](https://github.com/StaticJsCMS/static-cms/tree/main/packages/demo) | [demo-staticjscms.netlify.app](https://demo-staticjscms.netlify.app/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/8c1b73b5-d348-45cd-be2a-7af84be5541f/deploy-status)](https://app.netlify.com/sites/demo-staticjscms/deploys) |
|
||||
| [docs](https://github.com/StaticJsCMS/static-cms/tree/main/packages/docs) | [staticjscms.netlify.app](https://staticjscms.netlify.app/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/91f6eeb2-f1ed-4e4e-bdd1-f5c6bd01ccd5/deploy-status)](https://app.netlify.com/sites/staticjscms/deploys) |
|
||||
|
||||
# Platform Templates
|
||||
|
||||
|Name|Demo|Status|
|
||||
|---|---|---|
|
||||
| [Next](https://nextjs.org/) - [static-cms-next-netlify-template](https://github.com/StaticJsCMS/static-cms-next-netlify-template) | [next-template.staticcms.org](https://next-template.staticcms.org/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/d1b5d377-b5b3-4a4d-8034-21ba585cd444/deploy-status)](https://app.netlify.com/sites/static-cms-next/deploys) |
|
||||
| [Gatsby](https://www.gatsbyjs.com/) - [static-cms-gatsby-netlify-template](https://github.com/StaticJsCMS/static-cms-gatsby-netlify-template) | [gatsby.staticcms.org](https://gatsby.staticcms.org/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/6a9191dd-0f22-4942-8845-cb855e9efcd8/deploy-status)](https://app.netlify.com/sites/static-cms-gatsby/deploys) |
|
||||
| [Hugo](https://gohugo.io/) - [static-cms-hugo-netlify-template](https://github.com/StaticJsCMS/static-cms-hugo-netlify-template) | [hugo.staticcms.org](https://hugo.staticcms.org/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/66a114d7-c5a8-4f03-ae35-a35f88fb1d90/deploy-status)](https://app.netlify.com/sites/static-cms-hugo/deploys) |
|
||||
| [Nuxt](https://nuxtjs.org/) - [static-cms-nuxt-netlify-template](https://github.com/StaticJsCMS/static-cms-nuxt-netlify-template) | [nuxt.staticcms.org](https://nuxt.staticcms.org/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/eea4314f-e9ae-4414-8ed5-e14d69e50971/deploy-status)](https://app.netlify.com/sites/static-cms-nuxt/deploys) |
|
||||
| [Preact](https://preactjs.com/) - [static-cms-preact-netlify-template](https://github.com/StaticJsCMS/static-cms-preact-netlify-template) | [preact.staticcms.org](https://preact.staticcms.org/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/0cf054ad-1be4-4d93-8a3a-0841475e6032/deploy-status)](https://app.netlify.com/sites/static-cms-preact/deploys) |
|
||||
| [Eleventy](https://www.11ty.dev/) - [static-cms-eleventy-netlify-template](https://github.com/StaticJsCMS/static-cms-eleventy-netlify-template) | [eleventy.staticcms.org](https://eleventy.staticcms.org/) | [![Netlify Status](https://api.netlify.com/api/v1/badges/1880280d-def5-4773-9db3-d0315a986d45/deploy-status)](https://app.netlify.com/sites/static-cms-eleventy/deploys) |
|
||||
| Name | Status |
|
||||
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [Next](https://nextjs.org/) - [static-cms-next-netlify-template](https://github.com/StaticJsCMS/static-cms-next-netlify-template) | [![Netlify Status](https://api.netlify.com/api/v1/badges/d1b5d377-b5b3-4a4d-8034-21ba585cd444/deploy-status)](https://app.netlify.com/sites/static-cms-next/deploys) |
|
||||
| [Gatsby](https://www.gatsbyjs.com/) - [static-cms-gatsby-netlify-template](https://github.com/StaticJsCMS/static-cms-gatsby-netlify-template) | [![Netlify Status](https://api.netlify.com/api/v1/badges/6a9191dd-0f22-4942-8845-cb855e9efcd8/deploy-status)](https://app.netlify.com/sites/static-cms-gatsby/deploys) |
|
||||
| [Hugo](https://gohugo.io/) - [static-cms-hugo-netlify-template](https://github.com/StaticJsCMS/static-cms-hugo-netlify-template) | [![Netlify Status](https://api.netlify.com/api/v1/badges/66a114d7-c5a8-4f03-ae35-a35f88fb1d90/deploy-status)](https://app.netlify.com/sites/static-cms-hugo/deploys) |
|
||||
| [Nuxt](https://nuxtjs.org/) - [static-cms-nuxt-netlify-template](https://github.com/StaticJsCMS/static-cms-nuxt-netlify-template) | [![Netlify Status](https://api.netlify.com/api/v1/badges/eea4314f-e9ae-4414-8ed5-e14d69e50971/deploy-status)](https://app.netlify.com/sites/static-cms-nuxt/deploys) |
|
||||
| [Preact](https://preactjs.com/) - [static-cms-preact-netlify-template](https://github.com/StaticJsCMS/static-cms-preact-netlify-template) | [![Netlify Status](https://api.netlify.com/api/v1/badges/0cf054ad-1be4-4d93-8a3a-0841475e6032/deploy-status)](https://app.netlify.com/sites/static-cms-preact/deploys) |
|
||||
| [Eleventy](https://www.11ty.dev/) - [static-cms-eleventy-netlify-template](https://github.com/StaticJsCMS/static-cms-eleventy-netlify-template) | [![Netlify Status](https://api.netlify.com/api/v1/badges/1880280d-def5-4773-9db3-d0315a986d45/deploy-status)](https://app.netlify.com/sites/static-cms-eleventy/deploys) |
|
||||
|
||||
# Other Projects
|
||||
|
||||
| Name | Status |
|
||||
|---|---|
|
||||
| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [static-cms-proxy-server](https://github.com/StaticJsCMS/static-cms-proxy-server) | [![Build and Test](https://github.com/StaticJsCMS/static-cms-proxy-server/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/StaticJsCMS/static-cms-proxy-server/actions/workflows/build-and-test.yml) [![npm latest package](https://img.shields.io/npm/v/@staticcms/proxy-server/latest.svg)](https://www.npmjs.com/package/@staticcms/proxy-server) |
|
||||
| [gatsby-plugin-static-cms](https://github.com/StaticJsCMS/gatsby-plugin-static-cms) | [![Build](https://github.com/StaticJsCMS/gatsby-plugin-static-cms/actions/workflows/build.yml/badge.svg)](https://github.com/StaticJsCMS/gatsby-plugin-static-cms/actions/workflows/build.yml) [![npm latest package](https://img.shields.io/npm/v/gatsby-plugin-static-cms/latest.svg)](https://www.npmjs.com/package/gatsby-plugin-static-cms) |
|
||||
|
||||
|
@ -15,7 +15,7 @@ describe('Markdown widget link', () => {
|
||||
|
||||
describe('link', () => {
|
||||
it('can add a new valid link', () => {
|
||||
const link = 'https://www.staticcms.org/';
|
||||
const link = 'https://staticjscms.netlify.app/';
|
||||
cy.window().then(win => {
|
||||
cy.stub(win, 'prompt').returns(link);
|
||||
});
|
||||
@ -30,7 +30,7 @@ describe('Markdown widget link', () => {
|
||||
});
|
||||
|
||||
it('can add a new invalid link', () => {
|
||||
const link = 'www.staticcms.org';
|
||||
const link = 'staticjscms.netlify.app';
|
||||
cy.window().then(win => {
|
||||
cy.stub(win, 'prompt').returns(link);
|
||||
});
|
||||
@ -45,7 +45,7 @@ describe('Markdown widget link', () => {
|
||||
});
|
||||
|
||||
it('can select existing text as link', () => {
|
||||
const link = 'https://www.staticcms.org';
|
||||
const link = 'https://staticjscms.netlify.app';
|
||||
cy.window().then(win => {
|
||||
cy.stub(win, 'prompt').returns(link);
|
||||
});
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
[[redirects]]
|
||||
from = "https://staticjscms.netlify.app/*"
|
||||
to = "https://www.staticcms.org/:splat"
|
||||
to = "https://staticjscms.netlify.app/:splat"
|
||||
status = 301
|
||||
|
||||
[[redirects]]
|
||||
from = "https://staticjscms.netlify.app/"
|
||||
to = "https://www.staticcms.org/"
|
||||
to = "https://staticjscms.netlify.app/"
|
||||
status = 301
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
{
|
||||
"base_url": "https://staticcms.org/",
|
||||
"base_url": "https://staticjscms.netlify.app/",
|
||||
"repo_url": "https://github.com/StaticJsCMS/static-cms",
|
||||
"site_title": "Static CMS | Open Source Content Management System",
|
||||
"site_description": "Open source content management for your Git workflow. Use Static CMS with any static site generator for a faster and more flexible web project.",
|
||||
|
@ -15,7 +15,7 @@ Alternatively, you can specify a custom config file using a link tag:
|
||||
|
||||
If you prefer, you can use a javascript file (`admin/config.js`) instead of a yaml file. Simply import the javascript config and pass it into your `CMS.init({ config })` call.
|
||||
|
||||
To see working configuration examples, you can [start from a template](/docs/start-with-a-template) or check out the [CMS demo site](https://demo.staticcms.org/). (No login required: click the login button and Static CMS will open.) You can refer to the demo [configuration code](https://github.com/StaticJsCMS/static-cms/blob/main/core/dev-test/config.yml) to see how each option was configured.
|
||||
To see working configuration examples, you can [start from a template](/docs/start-with-a-template) or check out the [CMS demo site](https://demo-staticjscms.netlify.app/). (No login required: click the login button and Static CMS will open.) You can refer to the demo [configuration code](https://github.com/StaticJsCMS/static-cms/blob/main/core/dev-test/config.yml) to see how each option was configured.
|
||||
|
||||
You can find details about all configuration options below. Note that [YAML syntax](https://en.wikipedia.org/wiki/YAML#Basic_components) allows lists and objects to be written in block or inline style, and the code samples below include a mix of both.
|
||||
|
||||
@ -67,7 +67,7 @@ backend: {
|
||||
Static CMS generates the following commit types:
|
||||
|
||||
| Commit type | When is it triggered? | Available template tags |
|
||||
| ------------- | ---------------------------- | ----------------------------------------------------------- |
|
||||
| ------------- | ---------------------------- | --------------------------------------------------------------------- |
|
||||
| `create` | A new entry is created | `slug`, `path`, `collection`, `author-login`, `author-name`, `fields` |
|
||||
| `update` | An existing entry is changed | `slug`, `path`, `collection`, `author-login`, `author-name`, `fields` |
|
||||
| `delete` | An existing entry is deleted | `slug`, `path`, `collection`, `author-login`, `author-name` |
|
||||
|
@ -17,7 +17,7 @@ At its core, Static CMS is an open-source React app that acts as a wrapper for t
|
||||
|
||||
## Find out more
|
||||
|
||||
- Get a feel for the UI in the [demo site](https://demo.staticcms.org/). (No login required. Click the login button to go straight to the Static CMS editor UI.)
|
||||
- Get a feel for the UI in the [demo site](https://demo-staticjscms.netlify.app/). (No login required. Click the login button to go straight to the Static CMS editor UI.)
|
||||
- [Start with a template](/docs/start-with-a-template/) to make a Static CMS-enabled site of your own.
|
||||
- Configure your existing site by following a [tutorial](/docs/add-to-your-site/) or checking [configuration options](/docs/configuration-options).
|
||||
- Ask questions and share ideas in the Static CMS [community chat](/chat).
|
||||
|
@ -6,7 +6,7 @@ weight: 60
|
||||
|
||||
- **Name**: `gitlab`
|
||||
|
||||
You can use the `test-repo` backend to try out Static CMS without connecting to a Git repo. With this backend, you can write and publish content normally, but any changes will disappear when you reload the page. This backend powers the Static CMS [demo site](https://demo.staticcms.org/).
|
||||
You can use the `test-repo` backend to try out Static CMS without connecting to a Git repo. With this backend, you can write and publish content normally, but any changes will disappear when you reload the page. This backend powers the Static CMS [demo site](https://demo-staticjscms.netlify.app/).
|
||||
|
||||
**Note:** The `test-repo` backend cannot access your local file system, nor does it connect to a Git repo, thus you will not see any existing files while using it.
|
||||
|
||||
|
@ -8,7 +8,7 @@ Widgets define the data type and interface for entry fields. Static CMS comes wi
|
||||
|
||||
Widgets are specified as collection fields in the Static CMS `config` file. Note that [YAML syntax](https://en.wikipedia.org/wiki/YAML#Basic_components) allows lists and objects to be written in block or inline style, and the code samples below include a mix of both.
|
||||
|
||||
To see working examples of all of the built-in widgets, try making a 'Kitchen Sink' collection item on the [CMS demo site](https://demo.staticcms.org/). (No login required: click the login button and Static CMS will open.) You can refer to the demo [configuration code](https://github.com/StaticJsCMS/static-cms/blob/main/dev-test/config.yml) to see how each field was configured.
|
||||
To see working examples of all of the built-in widgets, try making a 'Kitchen Sink' collection item on the [CMS demo site](https://demo-staticjscms.netlify.app/). (No login required: click the login button and Static CMS will open.) You can refer to the demo [configuration code](https://github.com/StaticJsCMS/static-cms/blob/main/dev-test/config.yml) to see how each field was configured.
|
||||
|
||||
## Available Widgets
|
||||
|
||||
@ -38,7 +38,7 @@ To see working examples of all of the built-in widgets, try making a 'Kitchen Si
|
||||
The following options are available on all fields:
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --------- | -------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| --------- | -------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| name | string | | The name of the field |
|
||||
| widget | string | `'string'` | _Optional_. The type of widget to render for the field |
|
||||
| label | string | `name` | _Optional_. The display name of the field |
|
||||
@ -280,7 +280,7 @@ collections:
|
||||
- yes
|
||||
- no
|
||||
|
||||
```
|
||||
````
|
||||
|
||||
```js
|
||||
collections: [
|
||||
@ -332,6 +332,6 @@ collections: [
|
||||
]
|
||||
}
|
||||
],
|
||||
```
|
||||
````
|
||||
|
||||
</CodeTabs>
|
||||
|
@ -104,8 +104,8 @@ const StyledDesktopLink = styled(Button)(
|
||||
`,
|
||||
) as ExtendButtonBase<ButtonTypeMap<{}, 'a'>>;
|
||||
|
||||
const STATIC_CMS_DOMAIN = 'staticcms.org';
|
||||
const DEFAULT_DEMO_SITE = 'demo.staticcms.org';
|
||||
const STATIC_CMS_DOMAIN = 'staticjscms.netlify.app';
|
||||
const DEFAULT_DEMO_SITE = 'demo-staticjscms.netlify.app';
|
||||
const STATIC_CMS_DOMAIN_REGEX = /staticcms\.org$/g;
|
||||
|
||||
function createDemoUrl(subdomain?: string): string {
|
||||
|
@ -1,11 +1,8 @@
|
||||
import Alert from '@mui/material/Alert';
|
||||
import AlertTitle from '@mui/material/AlertTitle';
|
||||
import Box from '@mui/material/Box';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { styled } from '@mui/material/styles';
|
||||
import { format, parseISO } from 'date-fns';
|
||||
import Link from 'next/link';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import Container from '../components/layout/Container';
|
||||
import Page from '../components/layout/Page';
|
||||
@ -94,33 +91,7 @@ const StyledLink = styled(Link)(
|
||||
`,
|
||||
);
|
||||
|
||||
function getVersionNumber(version: string): number {
|
||||
return +version.replace('v', '');
|
||||
}
|
||||
|
||||
function isNextVersion(latestMajorVersionNumber: number, version: string): boolean {
|
||||
if (getVersionNumber(version) > latestMajorVersionNumber) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getMajorVersion(version: string): string {
|
||||
return version.split('.')[0];
|
||||
}
|
||||
|
||||
const Releases = ({ docsGroups, searchablePages }: DocsMenuProps) => {
|
||||
const latestMajorVersion = useMemo(
|
||||
() => getMajorVersion((releaseData.find(r => r.type === 'major') ?? releaseData[0]).version),
|
||||
[],
|
||||
);
|
||||
|
||||
const latestMajorVersionNumber = useMemo(
|
||||
() => getVersionNumber(latestMajorVersion),
|
||||
[latestMajorVersion],
|
||||
);
|
||||
|
||||
return (
|
||||
<Page url="/releases" docsGroups={docsGroups} searchablePages={searchablePages} fullWidth>
|
||||
<StyledReleaseContent>
|
||||
@ -138,29 +109,9 @@ const Releases = ({ docsGroups, searchablePages }: DocsMenuProps) => {
|
||||
</Typography>
|
||||
</StyledTitle>
|
||||
</Container>
|
||||
<Container>
|
||||
<Alert severity="warning" sx={{ alignSelf: 'flex-start' }}>
|
||||
<AlertTitle>
|
||||
<strong>Note</strong>
|
||||
</AlertTitle>
|
||||
<Typography variant="subtitle1" component="div" color="inherit">
|
||||
<span>
|
||||
The current docs are for Static CMS v{latestMajorVersionNumber}. For Static CMS v
|
||||
{latestMajorVersionNumber - 1}, see
|
||||
</span>
|
||||
<StyledLink href={`https://v${latestMajorVersionNumber - 1}.staticcms.org`}>
|
||||
https://v{latestMajorVersionNumber - 1}.staticcms.org
|
||||
</StyledLink>
|
||||
.
|
||||
</Typography>
|
||||
</Alert>
|
||||
</Container>
|
||||
<Container>
|
||||
<StyledReleaseLinksContent>
|
||||
{releaseData.map(release => {
|
||||
const majorVersion = getMajorVersion(release.version);
|
||||
const isNext = isNextVersion(latestMajorVersionNumber, majorVersion);
|
||||
|
||||
return (
|
||||
<StyledReleaseSection key={release.version}>
|
||||
<Typography variant="h3" color="primary.main">
|
||||
@ -184,18 +135,6 @@ const Releases = ({ docsGroups, searchablePages }: DocsMenuProps) => {
|
||||
>
|
||||
Changelog
|
||||
</StyledLink>
|
||||
<StyledLink
|
||||
href={`https://${
|
||||
isNext
|
||||
? 'next'
|
||||
: majorVersion !== latestMajorVersion
|
||||
? majorVersion
|
||||
: 'www'
|
||||
}.staticcms.org/docs`}
|
||||
target={majorVersion !== latestMajorVersion ? '_blank' : undefined}
|
||||
>
|
||||
Docs
|
||||
</StyledLink>
|
||||
</Box>
|
||||
</Typography>
|
||||
</StyledReleaseSection>
|
||||
|
Loading…
x
Reference in New Issue
Block a user