

Vuepress添加侧边栏访问地图
source link: https://wiki.eryajf.net/pages/76f813/#_2-%E9%85%8D%E7%BD%AE
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Vuepress添加侧边栏访问地图
博客迁移之后一直心心念念的老博客功能,莫过于首页右侧边栏的访问地球了,只是Vuepress似乎并不支持在边栏添加script,于是一直搁置了下来。
晚上在浏览主题官方文档的时候,无意看到一个定义html广告模块儿的姿势,于是乎开启了一段折腾之旅,这里赶忙做下记录。
# 1,效果
讲解配置过程之前,先看下配置完成之后的最终效果:
# 2,配置
通过网站REVLVERMAPS (opens new window)可以自定义我们想要的地图样式:
配置过程中,下边的方框中会自动生成对应的代码,我们可以拷贝对应的代码,一会儿用得到。
然后创建js文件 docs/.vuepress/config/htmlModules.js
// 官方文档:https://doc.xugaoyi.com/pages/a20ce8/#%E8%87%AA%E5%AE%9A%E4%B9%89html%E6%A8%A1%E5%9D%97
module.exports = {
// 利用广告模块儿,添加访问地球🌎
homeSidebarB: `<div style="width:100%;height:122px;color:#fff;background: #eee;"><a href="https://www.revolvermaps.com/livestats/5srkcv15atq/"><img src="//rf.revolvermaps.com/h/m/a/0/ff0000/128/10/5srkcv15atq.png" width="256" height="128" alt="Map" style="border:0;"></a></div>`,
}
2
3
4
5
然后在 docs/.vuepress/config/themeConfig.js
中引用即可:
const htmlModules = require('./htmlModules.js');
// 主题配置
module.exports = {
// 此处定义了访问地球功能
htmlModules,
}
2
3
4
5
6
7
然后运行起来,就可以看到对应的访问地图了。
Recommend
-
24
前言 一如既往,实战出真理. 有兴趣的可以瞧瞧,没兴趣的大佬请止步于此. 免得浪费您的时间 效果图 基于antd的sidebar组件封装 折腾记的技术栈选型 Mobx & mobx-react(用起来感觉良好的状态管理器) React 16
-
6
octopress侧边栏添加内容 2014-11-13 23:21:52 1.添加about页面 rake new_page[about] 会生成 source/about/index.markdown 文件。 编辑该文件的内容。 然后在头部导航菜单中添加页面的...
-
10
Vuepress添加评论插件valine # 1,valine 之前评论系统使用的gitalk,也不错,新的valine样式更好看一些,于是折腾了很久。 暂时汇总信息...
-
7
在 《一篇带你用 VuePress + Github Pages 搭建博客》中,我们使用 VuePress 搭建了一个博客,最...
-
11
在 《一篇带你用 VuePress + Github Pages 搭建博客》中,我们使用 VuePress 搭建了一个博客,最...
-
5
wordpress给网站侧边栏添加一个网站信息统计工具 2022-03-0...
-
18
V2EX › Windows win10 侧边栏快速访问中存的内网地址会导致在文件管理器中做增删需要按下 f5 刷新后才能显示
-
9
Hello主题搭配Elementor实现添加侧边栏小工具 2022-04-06
-
7
-
2
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK