Commit e4c2794
Changed files (4)
src
src/components/SideToolBar.astro
@@ -46,7 +46,7 @@ import TocButton from './widgets/SideToolBar/TocButton.vue';
const { icon, text } = item;
if ('href' in item)
return (
- <Button href={item.href} title={text}>
+ <Button href={item.href} target={item.blank ? '_blank' : undefined} title={text}>
<Icon name={icon} slot="icon" />
</Button>
);
src/types/config.ts
@@ -32,6 +32,14 @@ export type ButtonSubConfig<T extends string> = T extends 'text'
* 按钮的 URL。
*/
href?: string;
+ /**
+ * Whether to open the link in a new tab.
+ *
+ * 是否在新标签页中打开链接。
+ *
+ * @default false
+ */
+ blank?: boolean;
}
| {
/**
@@ -69,6 +77,14 @@ export type ButtonSubConfig<T extends string> = T extends 'text'
* 按钮的 URL。
*/
href?: string;
+ /**
+ * Whether to open the link in a new tab.
+ *
+ * 是否在新标签页中打开链接。
+ *
+ * @default false
+ */
+ blank?: boolean;
}
| {
/**
src/config.ts
@@ -106,6 +106,7 @@ export const navbarConfig: NavbarConfig = {
icon: 'material-symbols:rss-feed-rounded',
text: I18nKey.subscribe,
href: '/rss.xml',
+ blank: true,
},
{
icon: 'material-symbols:casino',