Skip to content

Commit

Permalink
chore(v2): mark tagline field as optional (#2342)
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 authored Feb 29, 2020
1 parent 7b2716e commit 3cbee86
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/docusaurus-types/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {ParsedUrlQueryInput} from 'querystring';
export interface DocusaurusConfig {
baseUrl: string;
favicon: string;
tagline: string;
tagline?: string;
title: string;
url: string;
organizationName?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/docusaurus/src/client/theme-fallback/Layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
function Layout(props) {
const context = useDocusaurusContext();
const {siteConfig = {}} = context;
const {favicon, tagline, title: defaultTitle} = siteConfig;
const {favicon, tagline = '', title: defaultTitle} = siteConfig;
const {children, title, description} = props;
const faviconUrl = useBaseUrl(favicon);
return (
<>
<Head defaultTitle={`${defaultTitle} · ${tagline}`}>
<Head defaultTitle={`${defaultTitle}${tagline ? ` · ${tagline}` : ''}`}>
{title && <title>{`${title} · ${tagline}`}</title>}
{favicon && <link rel="shortcut icon" href={faviconUrl} />}
{description && <meta name="description" content={description} />}
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus/src/server/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('loadConfig', () => {
expect(() => {
loadConfig(siteDir);
}).toThrowErrorMatchingInlineSnapshot(
`"The required field(s) 'favicon', 'tagline', 'url' are missing from docusaurus.config.js"`,
`"The required field(s) 'favicon', 'url' are missing from docusaurus.config.js"`,
);
});

Expand Down
3 changes: 2 additions & 1 deletion packages/docusaurus/src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import path from 'path';
import {CONFIG_FILE_NAME} from '../constants';
import {DocusaurusConfig, PluginConfig} from '@docusaurus/types';

const REQUIRED_FIELDS = ['baseUrl', 'favicon', 'tagline', 'title', 'url'];
const REQUIRED_FIELDS = ['baseUrl', 'favicon', 'title', 'url'];

const OPTIONAL_FIELDS = [
'organizationName',
Expand All @@ -25,6 +25,7 @@ const OPTIONAL_FIELDS = [
'themeConfig',
'scripts',
'stylesheets',
'tagline',
];

const DEFAULT_CONFIG: {
Expand Down
28 changes: 14 additions & 14 deletions website/docs/docusaurus.config.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ module.exports = {
};
```

### `tagline`

- Type: `string`

The tagline for your website.

```js
// docusaurus.config.js
module.exports = {
tagline:
'Docusaurus makes it easy to maintain Open Source documentation websites.',
};
```

### `favicon`

- Type: `string`
Expand Down Expand Up @@ -98,6 +84,20 @@ module.exports = {

## Optional fields

### `tagline`

- Type: `string`

The tagline for your website.

```js
// docusaurus.config.js
module.exports = {
tagline:
'Docusaurus makes it easy to maintain Open Source documentation websites.',
};
```

### `organizationName`

- Type: `string`
Expand Down

0 comments on commit 3cbee86

Please sign in to comment.