Skip to content

Commit

Permalink
feat: sns links can be customized now
Browse files Browse the repository at this point in the history
  • Loading branch information
Renovamen committed Apr 5, 2021
1 parent b682462 commit bd8ef00
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 29 deletions.
16 changes: 12 additions & 4 deletions example/docs/basic/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ date: 2021-02-03

The theme can be configured in `.vuepress/config.js`.

::: tip
Please make sure all the icons you specified in the configuration file are already imported, see [here](/docs/advanced/icons/) to know how to import icons.
:::


## Author Information

```js
Expand Down Expand Up @@ -41,6 +46,13 @@ module.exports = {
zhihu: 'chao-neng-gui-su', // Zhihu
weibo: 'your-weibo-id', // Sina Weibo
email: 'renovamenzxh@gmail.com', // Email
customize: [ // if you want to add other social platforms
{
icon: "ri-reddit-line", // platform icon
link: "https://www.reddit.com/user/oh-renovamen" // profile url
},
// ...
]
}
}
}
Expand Down Expand Up @@ -134,10 +146,6 @@ module.exports = {
}
```
::: tip
The icon specified by `searchIcon` should be imported first, see [here](/docs/advanced/icons/) for details.
:::
## Custom Footer
Expand Down
18 changes: 9 additions & 9 deletions example/docs/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ date: 2020-03-26

I wrote some plugins to implement some of the features of this theme. This section collects their documentation. Here is a list:

- [plugin-chart](/docs/plugins/chart): [Chart.js](https://www.chartjs.org) (charts)
- [plugin-mermaid](/docs/plugins/mermaid): [Mermaid](https://mermaid-js.github.io) (diagrams)
- [plugin-roughviz](/docs/plugins/roughviz): [roughViz.js](https://github.com/jwilber/roughViz) (sketchy/hand-drawn styled charts)
- [plugin-markmap](/docs/plugins/markmap): [markmap](https://github.com/gera2ld/markmap) (mind maps)
- [plugin-katex](/docs/plugins/katex): [KaTeX](https://katex.org/) (math rendering)
- [plugin-md-plus](/docs/plugins/md-plus): Adding more syntax to Markdown, now supports footnote and mark
- [plugin-reading-time](/docs/plugins/reading-time): Word count and reading time estimation
- [plugin-baidu-tongji](/docs/plugins/baidu-tongji): [Baidu Tongji](https://tongji.baidu.com/web/welcome/login) (site analytics)
- [plugin-rss](/docs/plugins/rss): RSS
- [plugin-chart](/docs/plugins/chart/): [Chart.js](https://www.chartjs.org) (charts)
- [plugin-mermaid](/docs/plugins/mermaid/): [Mermaid](https://mermaid-js.github.io) (diagrams)
- [plugin-roughviz](/docs/plugins/roughviz/): [roughViz.js](https://github.com/jwilber/roughViz) (sketchy/hand-drawn styled charts)
- [plugin-markmap](/docs/plugins/markmap/): [markmap](https://github.com/gera2ld/markmap) (mind maps)
- [plugin-katex](/docs/plugins/katex/): [KaTeX](https://katex.org/) (math rendering)
- [plugin-md-plus](/docs/plugins/md-plus/): Adding more syntax to Markdown, now supports footnote and mark
- [plugin-reading-time](/docs/plugins/reading-time/): Word count and reading time estimation
- [plugin-baidu-tongji](/docs/plugins/baidu-tongji/): [Baidu Tongji](https://tongji.baidu.com/web/welcome/login) (site analytics)
- [plugin-rss](/docs/plugins/rss/): RSS
16 changes: 12 additions & 4 deletions example/zh/docs/basic/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ date: 2021-02-03

`.vuepress/config.js` 中配置主题。

::: tip
对于所有涉及到图标名称的配置项,请确保指定的图标是被引入过的,在[这里](/zh/docs/advanced/icons/)查看怎么引入图标。
:::


## 作者信息

```js
Expand Down Expand Up @@ -41,6 +46,13 @@ module.exports = {
zhihu: 'chao-neng-gui-su', // 知乎
weibo: 'your-weibo-id', // 新浪微博
email: 'renovamenzxh@gmail.com', // 邮箱
customize: [ // 添加其他的社交平台
{
icon: "ri-reddit-line", // 社交平台的图标
link: "https://www.reddit.com/user/oh-renovamen" // 主页链接
},
// ...
]
}
}
}
Expand Down Expand Up @@ -134,10 +146,6 @@ module.exports = {
}
```
::: tip
需要保证 `searchIcon` 项指定的图标是被引入过的,在[这里](/zh/docs/advanced/icons/)查看怎么引入图标。
:::
## 页脚自定义
Expand Down
18 changes: 9 additions & 9 deletions example/zh/docs/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ date: 2020-03-26

这是插件列表:

- [plugin-chart](/docs/plugins/chart)[Chart.js](https://www.chartjs.org)(图表)
- [plugin-mermaid](/docs/plugins/mermaid)[Mermaid](https://mermaid-js.github.io)(流程图等)
- [plugin-roughviz](/docs/plugins/roughviz)[roughViz.js](https://github.com/jwilber/roughViz)(手绘风格图表)
- [plugin-markmap](/docs/plugins/markmap)[markmap](https://github.com/gera2ld/markmap)(思维导图)
- [plugin-katex](/docs/plugins/katex)[KaTeX](https://katex.org/)(公式渲染)
- [plugin-md-plus](/docs/plugins/md-plus): 给 Markdown 添加更多语法和功能,目前支持脚注和高亮标记
- [plugin-reading-time](/docs/plugins/reading-time):字数统计和阅读时长估计
- [plugin-baidu-tongji](/docs/plugins/baidu-tongji)[百度统计](https://tongji.baidu.com/web/welcome/login)
- [plugin-rss](/docs/plugins/rss):RSS
- [plugin-chart](/docs/plugins/chart/)[Chart.js](https://www.chartjs.org)(图表)
- [plugin-mermaid](/docs/plugins/mermaid/)[Mermaid](https://mermaid-js.github.io)(流程图等)
- [plugin-roughviz](/docs/plugins/roughviz/)[roughViz.js](https://github.com/jwilber/roughViz)(手绘风格图表)
- [plugin-markmap](/docs/plugins/markmap/)[markmap](https://github.com/gera2ld/markmap)(思维导图)
- [plugin-katex](/docs/plugins/katex/)[KaTeX](https://katex.org/)(公式渲染)
- [plugin-md-plus](/docs/plugins/md-plus/): 给 Markdown 添加更多语法和功能,目前支持脚注和高亮标记
- [plugin-reading-time](/docs/plugins/reading-time/):字数统计和阅读时长估计
- [plugin-baidu-tongji](/docs/plugins/baidu-tongji/)[百度统计](https://tongji.baidu.com/web/welcome/login)
- [plugin-rss](/docs/plugins/rss/):RSS
1 change: 1 addition & 0 deletions packages/theme-gungnir/components/Common.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export default {
// margin-top -5px
& >>> .sns-wrapper
margin 0 auto
padding 0 5px
text-align center
position relative
.icon-stack
Expand Down
29 changes: 28 additions & 1 deletion packages/theme-gungnir/components/SNS.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<div class="sns-wrapper">
<!-- default sns -->
<a
v-for="(user, platform) in $themeConfig.personalInfo.sns"
v-for="(user, platform) in defaultSNS"
:key="`${platform}-${user}`"
:href="snsLink(user, platform)"
target="_blank"
Expand All @@ -12,6 +13,22 @@
<v-icon :name="snsIcon(platform)" class="icon-sns" inverse />
</v-icon>
</a>

<!-- customize sns -->
<a
v-for="item in $themeConfig.personalInfo.sns.customize"
:key="`customize-sns-${item.icon}-${item.link}`"
:href="item.link"
target="_blank"
rel="noopener noreferrer"
>
<v-icon class="icon-stack">
<v-icon v-if="large" name="fa-circle" scale="2.3" class="icon-circle" />
<v-icon :name="item.icon" class="icon-sns" inverse />
</v-icon>
</a>

<!-- rss -->
<a
v-if="$themeConfig.rss"
href="/rss.xml"
Expand Down Expand Up @@ -51,6 +68,16 @@ export default {
props: {
large: Boolean
},
computed: {
defaultSNS() {
let sns = {};
for (const platform in this.$themeConfig.personalInfo.sns) {
if (platform !== "customize")
sns[platform] = this.$themeConfig.personalInfo.sns[platform];
}
return sns;
}
},
methods: {
snsLink(user, platform) {
return platform_links[platform] + user;
Expand Down
4 changes: 2 additions & 2 deletions packages/theme-gungnir/global-components/CodeGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ h2, h3, h4, h5, h6
font-weight 600
outline none
&__nav-tab-active
border-bottom #42b983 1px solid
border-bottom $accentColorDark 1px solid
.pre-blank
color #42b983
color $accentColorDark
@media (max-width: $MQMobileNarrow)
.theme-code-group
Expand Down

1 comment on commit bd8ef00

@vercel
Copy link

@vercel vercel bot commented on bd8ef00 Apr 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.