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

“日志”链接路径最新版本不正确,404,和“归档”路径不同 #265

Open
Summer-Coming opened this issue Dec 4, 2019 · 6 comments

Comments

@Summer-Coming
Copy link

我的理解是:点击“日志”和“归档”跳转到的是同一个页面,但是,如果给“归档”菜单配置了图标以后,即:“archives: /archives/|| archive”,最新版“归档”的链接是:/archives/,即我们menu配置的正确的链接,但是“日志”的链接确没有断开,点击“日志”,显示链接的URL是:“http://localhost:4000/archives/|| archive”,导致页面不能链接到资源,404~

@Summer-Coming Summer-Coming changed the title “日志”链接路径最新版本不正确,和“归档”路径不同 “日志”链接路径最新版本不正确,404,和“归档”路径不同 Dec 4, 2019
@mpw9818
Copy link

mpw9818 commented Dec 27, 2019

我也是,有解决方案吗?

@ambition-zb
Copy link

我的也是

@sleepsheep66
Copy link

sleepsheep66 commented Jan 17, 2020

遇到同样的问题,查了一下是/next/layout/macro/siderbar.swig 里面有这样一段

    {% if config.archive_dir != '/' and site.posts.length > 0 %}
      <div class="site-state-item site-state-posts">
          {% if theme.menu.archives %}
             <a href="{{ url_for(theme.menu.archives).split('||')[0] | trim }}">
          {% else %}
             <a href="{{ url_for(config.archive_dir) }}">
          {% endif %}
          <span class="site-state-item-count">{{ site.posts.length }}</span>
          <span class="site-state-item-name">{{ __('state.posts') }}</span>
        </a>
      </div>
    {% endif %}

然而第一个A标签中split没有生效导致拆分不成数组,取不到数组第一个值,取得是所有的值
_config.xml中
menu:
home: /|| home
about: /about/|| user
tags: /tags/|| tags
categories: /categories/|| th
archives: /archives/|| archive
schedule: /schedule/|| calendar
archives的路径截取不出来,截取的路径是http://localhost:4000/sleepsheep66.githup.io/archives/%7C%7Carchive/
至于为什么split不生效 我也不知道

@sleepsheep66
Copy link

sleepsheep66 commented Jan 17, 2020

我现在是直接取下面A标签 注释掉带有split的A标签使其生效 希望哪位大佬告诉一下为什么split不生效

@imanoobtoo
Copy link

imanoobtoo commented Feb 15, 2020

遇到同样的问题,查了一下是/next/layout/macro/siderbar.swig 里面有这样一段

    {% if config.archive_dir != '/' and site.posts.length > 0 %}
      <div class="site-state-item site-state-posts">
          {% if theme.menu.archives %}
             <a href="{{ url_for(theme.menu.archives).split('||')[0] | trim }}">
          {% else %}
             <a href="{{ url_for(config.archive_dir) }}">
          {% endif %}
          <span class="site-state-item-count">{{ site.posts.length }}</span>
          <span class="site-state-item-name">{{ __('state.posts') }}</span>
        </a>
      </div>
    {% endif %}

然而第一个A标签中split没有生效导致拆分不成数组,取不到数组第一个值,取得是所有的值
_config.xml中
menu:
home: /|| home
about: /about/|| user
tags: /tags/|| tags
categories: /categories/|| th
archives: /archives/|| archive
schedule: /schedule/|| calendar
archives的路径截取不出来,截取的路径是http://localhost:4000/sleepsheep66.githup.io/archives/%7C%7Carchive/
至于为什么split不生效 我也不知道

我也是这个问题,找到你说的这个地方改成
a href="{{ url_for(theme.menu.archives.split('||')[0] | trim )}}"我试了下可以了,应该是url_for()的参数写错了位置。。

@Tinyuen
Copy link

Tinyuen commented Mar 4, 2020

代码写的好像有点问题,本地改了就好了
<a href="{{ url_for(theme.menu.archives.split('||')[0] | trim) }}">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants