The theme config is under the themeConfig in root config. For example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
// ...
}
});
Array[]The navigation bar of the site. The nav config is an array of NavItem, which has following type:
interface NavItem {
// The text of the nav item
text: string;
// The link href will be entered when click the nav item
link: '/';
// The active match rule of the nav item, optional
activeMatch: '^/$|^/';
}
The activeMatch is used to match the current route, and the nav item will be highlighted when the route matches the activeMatch rule.By default, the activeMatch is the link of the nav item.
For example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
nav: [
{
text: 'Home',
link: '/',
activeMatch: '^/$|^/'
}
]
}
});
ObjectThe sidebar of the site.The config is a object, which
// The key is the path of the sidebar group
// The value is sidebar group array
type Sidebar = Record<string, SidebarGroup[]>;
interface SidebarGroup {
// The text of the sidebar group
text: string;
// The child items of the sidebar group
items: SidebarItem[];
}
type SidebarItem = {
// The text of item
text: string;
// The link href of item
link: string;
};
For example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
sidebar: {
'/guide/': [
{
text: 'Guide',
items: [
{
text: 'Getting Started',
link: '/guide/getting-started'
}
]
}
]
}
}
});
Object | undefinedundefinedThe edit link of the site.If it's undefined, the edit link feature will be disabled.
The editLink config is an object of EditLink, which has following type:
export interface EditLink {
// Pattern for edit link.
pattern: string;
// Custom text for edit link.
text?: string;
}
For example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
editLink: {
pattern:
'https://github.com/sanyuan0704/island.js/tree/master/docs/:path',
text: '📝 Edit this page on GitHub'
}
}
});
:path will be replaced by the current page path.
string"Last Updated"The text of last updated time.
For example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
lastUpdatedText: 'Last Updated'
}
});
Object{}The footer of the home site.
The footer config is an object of Footer, which has following type:
export interface Footer {
message?: string;
copyright?: string;
}
For example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
footer: {
message: 'Powered by Island.js',
copyright: `© ${new Date().getFullYear()} Island.js`
}
}
});
Array[]The social links of the site.
The socialLinks config is an array of SocialLink, which has following type:
export interface SocialLink {
icon: SocialLinkIcon;
link: string;
}
For example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
socialLinks: [
{
icon: 'github',
link: 'https://github.com/sanyuan0704/island'
}
]
}
});
In current version, the
icononly supportsgithub.
stringConfigure the title of the outline in the right sidebar.
For example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
outlineTitle: 'ON THIS PAGE'
}
});
stringPrevious PageThe text of the previous page. for example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
prevPageText: 'Previous Page'
}
});
stringNext PageText for the next page. for example:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
nextPageText: 'Next Page'
}
});
ObjectundefinedI18n config. This config is an object, the key is the routing prefix of the corresponding language (such as /en), the value is LocaleConfig, the type is as follows:
export interface LocaleConfig {
// language name
lang?: string;
// HTML title
title?: string;
// HTML description
description?: string;
// Display text in corresponding language
label: string;
// Navbar config, of the same type as `themeConfig.nav`
nav?: NavItem[];
// Sidebar config, of the same type as `themeConfig.sidebar`
sidebar?: Sidebar;
// Outline title
outlineTitle?: string;
// The text of the last updated time
lastUpdatedText?: string;
// The text of the edit link
editLink?: EditLink;
// The text of the prev page
prevPageText?: string;
// The text of the next page
nextPageText?: string;
}
As you see, there are many fields in themeConfig that can be also configured in LocaleConfig, including:
But the LocaleConfig has higher priority.So it will override the corresponding field in themeConfig.
booleantrueWhether to enable search.You can disable it by setting it to false:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
search: false
}
});
booleantrueWhether to enable back top.You can disable it by setting it to false:
import { defineConfig } from 'islandjs';
export default defineConfig({
themeConfig: {
backTop: false
}
});