改主菜单开往为萌站异世界之旅-跃迁

起因是在 Mo 的记事簿这个博客看到主菜单的开往被改为了萌站异世界之旅跃迁的按钮,自己琢磨了一下搞出来了
代码不一定最好,如果有疑惑请在评论区指出,谢谢 qwq

该教程适用于 anzhiyu 主题,其他主题未测试
由于需要直接修改主题,请务必确认缩进并勤备份,以免操作失误导致对博客的破坏

  • 替换themes\anzhiyu\source\js\utils.js中第1092-1106行内容,注意缩进
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// 跳转异次元之旅-跃迁
totraveling: function () {
anzhiyu.snackbarShow(
"即将跳转到「异次元之旅-跃迁」项目的成员博客,不保证跳转网站的安全性和可用性",
element => {
element.style.opacity = 0;
travellingsTimer && clearTimeout(travellingsTimer);
},
5000,
"取消"
);
travellingsTimer = setTimeout(function () {
window.open("https://travel.moe/go.html?travel=on", "_blank");
}, "5000");
},
  • 替换themes\anzhiyu\layout\includes\header\nav.pug中内容
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
- const { darkmode } = theme
nav#nav
#nav-group
span#blog_name
if theme.nav.enable
.back-home-button
i.anzhiyufont.anzhiyu-icon-grip-vertical
.back-menu-list-groups
each group in theme.nav.menu
.back-menu-list-group
.back-menu-list-title= group.title
.back-menu-list
each item in group.item
a.back-menu-item(href=url_for(item.link), title=item.name)
img.back-menu-item-icon(src=item.icon alt=item.name)
span.back-menu-item-text= item.name
a#site-name(href=url_for('/') accesskey="h")
.title #[=config.title]
i.anzhiyufont.anzhiyu-icon-house-chimney
if (theme.nav.clock)
!=partial('includes/anzhiyu/clock', {}, {cache: true})

div.mask-name-container
#name-container
a#page-name(href="javascript:anzhiyu.scrollToDest(0, 500)") PAGE_NAME

#menus
!=partial('includes/header/menu_item', {}, {cache: true})
#nav-right
if theme.nav.travelling
.nav-button.only-home#travellings_button(title='随机前往一个异次元之旅-跃迁项目网站')
a.site-page(onclick='anzhiyu.totraveling()', title='随机前往一个异次元之旅-跃迁项目网站', href='javascript:void(0);', rel='external nofollow', data-pjax-state='external')
img.travel-icon(
src="https://bu.dusays.com/2025/06/14/684d99d607c49.png"
alt="",
style="width: 24px; height: 24px; vertical-align: middle;"
)
.nav-button#randomPost_button
a.site-page(onclick='toRandomPost()', title='随机前往一个文章', href='javascript:void(0);')
i.anzhiyufont.anzhiyu-icon-dice
if (theme.algolia_search.enable || theme.local_search.enable || theme.docsearch.enable)
div.nav-button#search-button
a.site-page.social-icon.search(href='javascript:void(0);', title='搜索🔍' accesskey="s")
i.anzhiyufont.anzhiyu-icon-magnifying-glass
span=' '+_p('search.title')

if theme.centerConsole.enable
input#center-console(type="checkbox")
label.widget(for="center-console" title=_p("中控台") onclick="anzhiyu.switchConsole();")
i.left
i.widget.center
i.widget.right

!=partial('includes/anzhiyu/console', {}, {cache:true})

div.nav-button#nav-totop
a.totopbtn(href='javascript:void(0);')
i.anzhiyufont.anzhiyu-icon-arrow-up
span#percent(onclick="anzhiyu.scrollToDest(0,500)") 0

#toggle-menu
a.site-page(href='javascript:void(0);' title="切换")
i.anzhiyufont.anzhiyu-icon-bars

该文件中按钮内容可以自行修改为需要的,图标也可以自行改为其他的图片或使用 anzhiyu 主题自带的图标,如果使用自带图标则不需要修改这么多,直接将第31行代码改为你需要的图标名就行