diff --git a/docs/config/frontmatter/friend.md b/docs/config/frontmatter/friend.md index 9cf982e2..01ef416c 100644 --- a/docs/config/frontmatter/friend.md +++ b/docs/config/frontmatter/friend.md @@ -14,6 +14,7 @@ permalink: /config/frontmatter/friends/ --- pageLayout: friends title: 友情链接 +cols: 2 list: - name: pengzhanbo @@ -62,13 +63,20 @@ list: 友情链接页的描述 -### contentPosition +### contentPosition - 类型: `'before' | 'after'` - 默认值: `'after'` markdown 内容在友情链接列表之前还是之后,默认插入到列表之后。 +### cols + +- 类型: `number` +- 默认值: `2` + +友情链接列表每行最大显示的列数,一般设置为 `2` / `3` 时最佳。 + ### list - 类型: `FriendsItem[]` diff --git a/docs/en/config/frontmatter/friend.md b/docs/en/config/frontmatter/friend.md index 18dcc50f..cb5b730c 100644 --- a/docs/en/config/frontmatter/friend.md +++ b/docs/en/config/frontmatter/friend.md @@ -14,6 +14,7 @@ Example: --- pageLayout: friends title: Friends Links +cols: 2 list: - name: pengzhanbo @@ -69,6 +70,13 @@ The description of the friends links page. Whether the markdown content is placed before or after the friends links list. By default, it is inserted after the list. +### cols + +- Type: `number` +- Default: `1` + +The maximum number of columns displayed per line in the friends link list is generally best set to `2` / `3`. + ### list - Type: `FriendsItem[]` diff --git a/docs/en/guide/features/friend-links.md b/docs/en/guide/features/friend-links.md index b207466f..1de60b46 100644 --- a/docs/en/guide/features/friend-links.md +++ b/docs/en/guide/features/friend-links.md @@ -17,6 +17,7 @@ friends: true title: Friend Links description: Description text for friend links permalink: /friends/ +cols: 2 contentPosition: after list: - diff --git a/docs/guide/features/friend-links.md b/docs/guide/features/friend-links.md index cba45b93..d973e51a 100644 --- a/docs/guide/features/friend-links.md +++ b/docs/guide/features/friend-links.md @@ -19,6 +19,7 @@ title: 友情链接 description: 友情链接描述文本 permalink: /friends/ contentPosition: after +cols: 2 list: - name: pengzhanbo diff --git a/theme/src/client/components/VPFriends.vue b/theme/src/client/components/VPFriends.vue index e5c9223e..054d6ae7 100644 --- a/theme/src/client/components/VPFriends.vue +++ b/theme/src/client/components/VPFriends.vue @@ -12,10 +12,20 @@ const { frontmatter: matter, page } = useData<'friends'>() const list = computed(() => matter.value.list || []) const groups = computed(() => matter.value.groups || []) +const cols = computed(() => { + const cols = matter.value.cols || 2 + if (cols < 1) + return 1 + + return cols +})