Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor sub-menu #492

Merged
merged 7 commits into from
Mar 18, 2022
Merged

Refactor sub-menu #492

merged 7 commits into from
Mar 18, 2022

Conversation

stevenjoezhang
Copy link
Member

@stevenjoezhang stevenjoezhang commented Mar 16, 2022

PR Checklist

  • The commit message follows guidelines for NexT.
  • Tests for the changes was maked (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs in NexT website have been added / updated (for features).

PR Type

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Documentation.
  • Translation.
  • Other... Please describe:

What is the current behavior?

Issue resolved:

What is the new behavior?

  • Link to demo site with this changes:
  • Screenshots with this changes:

How to use?

In NexT _config.yml:

@coveralls
Copy link

coveralls commented Mar 16, 2022

Pull Request Test Coverage Report for Build 2000298488

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.468%

Totals Coverage Status
Change from base Build 1991192564: 0.0%
Covered Lines: 138
Relevant Lines: 141

💛 - Coveralls

@stevenjoezhang stevenjoezhang marked this pull request as ready for review March 16, 2022 10:41
@AmenLi
Copy link

AmenLi commented Mar 16, 2022

你好,试用了一下这个分支,有几个问题不理解

我是用npm安装的主题,在没用这个分支前,sub-menu表现和文档网站一样,没有问题

然后我拉取这个PR到本地,把这个PR修改的几个文件,替换到npm安装的主题相应路径下
出现了几个问题:

  1. 就是 / 的转义问题,在 a404c65 之前,会有两个 // 符号 Imgura404c65 之后,只有一个 / 符号 Imgur,但地址栏的URL还是会有转义问题
  2. sub-menu 只剩一个二级菜单了
    二级菜单只会出现在配置里设置default的页面里 Imgur
    这是我menu的配置代码及其对应的目录树 Imgur,.yml 的配置代码没有改过
    languages里没有翻译的词,我就直接使用了中文做key,也没有使用custom_file_path

在第一次试用时候,还没有a404c65这个fix提交。
实际的文件夹和index.md都是手动新建,没有使用命令建立。hexo clean & hexo s 启动网站后,发现share/media 下第三级菜单无法显示,而且连二级菜单都没有显示 Imgur

我以为是我实际目录没用命令建立的关系,就删除文件夹,重新用命令建立
hexo new page --p guide/index "站内教程"
hexo new page --p wiki/index "维基"
hexo new page --p share/index "分享首页"
hexo new page --p share/guide/index "分享教程"
hexo new page --p share/builds/index "分享BD"
hexo new page --p share/tools/index "分享工具"
hexo new page --p share/media/index "分享媒体"
hexo new page --p share/media/videos/index "分享视频"
hexo new page --p share/media/pictures/index "图片首页"
hexo new page --p share/media/music/index "音乐首页"
hexo new page --p share/media/others/index "其它首页"
hexo new page --p tags/index "标签"
hexo new page --p categories/index "分类"
hexo new page --p about/index "关于"
hexo new page -p about/site/index "网站"
hexo new page -p about/webmaster/index "站长"
整体的目录树和上面一致

hexo clean & hexo s 启动网站后,问题依旧;然后拉取到最新的a404c65,再试,还是一样问题。
视频展示:https://youtu.be/-rnbKwLtw0g
4. 面包屑的语言问题
查看上面2.的图片就会看见,只有share的中文名“分享”会被正确显示出来,但about的中文“关于”还是英文。Imgur

请问是我哪里操作有问题吗?

@stevenjoezhang
Copy link
Member Author

感谢回复。有点奇怪,URL 不应该被转义,我这是正常的

2022-03-17.1.09.03.mov

你能不能试试新开一个 hexo 文件夹,重新用命令建立一下,看看问题是否依然存在?

GitHub 可以直接上传视频和图片

@AmenLi
Copy link

AmenLi commented Mar 16, 2022

这次我是按以下步骤做的:

新建项目文件夹nexttest
在PowerShell中打开,执行 hexo init
执行hexo s,确认hexo能成功启动
在项目文件夹执行 git clone https://github.com/next-theme/hexo-theme-next themes/next
修改 _config.yml 的主题配置为next
复制 node_modules\hexo-theme-next_config.yml 到 _config.yml 同目录下,改名为 _config.next.yml
启用 scheme: Gemini
拉取这个#492的menu PR
git fetch origin pull/492/head:refactor-sub-menu
显示: * [new ref] refs/pull/492/head -> refactor-sub-menu
git checkout refactor-sub-menu
显示:Switched to branch 'refactor-sub-menu'

用命令建立相关文件夹,并只修改 "menu:" 的配置
menu:
home: / || fa fa-solid fa-house
教程: /guide/ || fa fas fa-edit
维基: /wiki/ || fa fa-solid fa-atom
分享:
default: /share/ || fa fas fa-share-alt
教程: /guide/ || fa fas fa-edit
流派: /builds/ || fa fa-solid fa-brain
工具: /tools/ || fa fa-solid fa-screwdriver-wrench
媒体:
default: /media/ || fa fa-solid fa-photo-film
视频: /videos/ || fa fa-brands fa-youtube
图片: /pictures/ || fa fa-solid fa-images
音频: /music/ || fa fa-solid fa-music
其它: /others/ || fa fa-solid fa-folder-open
tags: /tags/ || fa fa-solid fa-tags
categories: /categories/ || fa fa-solid fa-list-ul
archives: /archives/ || fa fa-solid fa-inbox
about:
default: /about/ || fa fa-solid fa-circle-info
关于网站: /site/ || fa fa-solid fa-earth-asia
关于站长: /webmaster/ || fa fa-solid fa-user-shield

hexo new page --p guide/index "站内教程"
hexo new page --p wiki/index "维基"
hexo new page --p share/index "分享首页"
hexo new page --p share/guide/index "分享教程"
hexo new page --p share/builds/index "分享BD"
hexo new page --p share/tools/index "分享工具"
hexo new page --p share/media/index "分享媒体"
hexo new page --p share/media/videos/index "分享视频"
hexo new page --p share/media/pictures/index "图片首页"
hexo new page --p share/media/music/index "音乐首页"
hexo new page --p share/media/others/index "其它首页"
hexo new page --p tags/index "标签"
hexo new page --p categories/index "分类"
hexo new page --p about/index "关于"
hexo new page -p about/site/index "网站"
hexo new page -p about/webmaster/index "站长"

执行hexo clean & hexo s 确认菜单效果

全程我录制了视频,但问题依旧,是我拉取PR没生效吗?我对git不熟,参考的是这个文档

github限制我10mb大小的视频,只能用youtube,视频在这:https://youtu.be/w9XGfCo5D7Y

录完视频之后我以为git用法我用错了,安装了 GitHub CLI
在 "path\nexttest\themes\next"目录下执行了 gh pr checkout 492
显示:
Switched to a new branch 'menu'
branch 'menu' set up to track 'origin/menu'.
hexo clean & hexo s 重启网站,还是和视频一样的效果
命令:gh pr checks
显示:
Relevant pull requests in next-theme/hexo-theme-next

Current branch
#492 Refactor sub-menu [menu]
× 1/14 checks failing

Created by you
You have no open pull requests

Requesting a code review from you
You have no pull requests to review

@stevenjoezhang
Copy link
Member Author

我知道了,Windows 上 path.join 会产生 \ (所以会变成 %5c),而类 UNIX 系统上是 /。我看看怎么解决这个路径的问题。

@stevenjoezhang
Copy link
Member Author

@AmenLemon 你再更新一下试试

@stevenjoezhang stevenjoezhang added this to the 8.10.2 milestone Mar 17, 2022
@AmenLi
Copy link

AmenLi commented Mar 17, 2022

@AmenLemon 你再更新一下试试

在“nexttest”文件夹下测试完了,转义问题解决了,相应的菜单不显示问题也跟着解决了。
只剩一点,当语言设置为简体中文时(language: zh-CN),其它配置未修改,只有面包屑的“about”无法被翻译

Snipaste_2022-03-17_19-15-57

我另外用custom_file_path: 对menu下的英文做测试翻译,还是无法显示中文

# language
zh-CN:
  menu:
    about: 测试

Snipaste_2022-03-17_19-33-39

目前我直接使用中文做配置,可以临时解决问题,影响不大
Snipaste_2022-03-17_19-21-52

@stevenjoezhang
Copy link
Member Author

@AmenLemon 翻译问题现在应该也修复了,你再试试有没有其他问题

@AmenLi
Copy link

AmenLi commented Mar 18, 2022

都可以了,暂时没发现其它问题

@stevenjoezhang
Copy link
Member Author

好的,我先合并了,发现其它问题欢迎继续回复

@stevenjoezhang stevenjoezhang merged commit e166885 into master Mar 18, 2022
@stevenjoezhang stevenjoezhang deleted the menu branch March 18, 2022 08:42
@stevenjoezhang stevenjoezhang mentioned this pull request Jul 25, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants