Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit eba8372

Browse files
authored
feat: add a new setting logo_link (#1070)
1 parent 32684a0 commit eba8372

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

packages/core/dev-test/config.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
backend:
22
name: test-repo
3+
logo_link: '/#/page/custom-page'
34
site_url: 'https://example.com'
45
media_folder: /assets/uploads
56
media_library:

packages/core/src/components/navbar/Navbar.tsx

+17-4
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,23 @@ const Navbar: FC<NavbarProps> = ({
7676
<div className={classes.breadcrumbs}>
7777
<div className={classes['logo-wrapper']}>
7878
{config?.logo_url ? (
79-
<div
80-
className={classNames(classes.logo, classes['custom-logo'])}
81-
style={{ backgroundImage: `url('${config.logo_url}')` }}
82-
/>
79+
config.logo_link ? (
80+
<a href={config.logo_link}>
81+
<div
82+
className={classNames(classes.logo, classes['custom-logo'])}
83+
style={{ backgroundImage: `url('${config.logo_url}')` }}
84+
/>
85+
</a>
86+
) : (
87+
<div
88+
className={classNames(classes.logo, classes['custom-logo'])}
89+
style={{ backgroundImage: `url('${config.logo_url}')` }}
90+
/>
91+
)
92+
) : config?.logo_link ? (
93+
<a href={config.logo_link}>
94+
<StaticCmsIcon className={classes.logo} />
95+
</a>
8396
) : (
8497
<StaticCmsIcon className={classes.logo} />
8598
)}

packages/core/src/constants/configSchema.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ function getConfigSchema() {
488488
display_url: { type: 'string', examples: ['https://example.com'] },
489489
base_url: { type: 'string' },
490490
logo_url: { type: 'string', examples: ['https://example.com/images/logo.svg'] },
491+
logo_link: { type: 'string', examples: ['https://example.com'] },
491492
media_folder: { type: 'string', examples: ['assets/uploads'] },
492493
public_folder: { type: 'string', examples: ['/uploads'] },
493494
media_folder_relative: { type: 'boolean' },

packages/core/src/interface.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,7 @@ export interface Config<EF extends BaseField = UnknownField> {
10471047
display_url?: string;
10481048
base_url?: string;
10491049
logo_url?: string;
1050+
logo_link?: string;
10501051
media_folder?: string;
10511052
public_folder?: string;
10521053
media_folder_relative?: boolean;

packages/docs/content/docs/configuration-options.mdx

+3
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,19 @@ display_url: 'https://your-site.com',
203203
## Custom Logo
204204

205205
When the `logo_url` setting is specified, the Static CMS UI will change the logo displayed at the top of the login page, allowing you to brand Static CMS with your own logo. `logo_url` is assumed to be a URL to an image file.
206+
When the `logo_link` setting is specified, the Static CMS UI will wrap the logo in a link, allowing you to make the logo clickable. `logo_link` can be a URL to an external page or an address of one of Static CMS pages giving you a quick link to your favourite page.
206207

207208
**Example:**
208209

209210
<CodeTabs>
210211
```yaml
211212
logo_url: https://your-site.com/images/logo.svg
213+
logo_link: https://your-site.com
212214
```
213215

214216
```js
215217
logo_url: 'https://your-site.com/images/logo.svg',
218+
logo_link: 'https://your-site.com',
216219
```
217220

218221
</CodeTabs>

0 commit comments

Comments
 (0)