iissnan / theme-next-docs

Documentations for NexT theme
http://theme-next.iissnan.com/
166 stars 55 forks source link

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

Open Summer-Coming opened 4 years ago

Summer-Coming commented 4 years ago

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

mpw9818 commented 4 years ago

我也是,有解决方案吗?

ambition-zb commented 4 years ago

我的也是

sleepsheep66 commented 4 years ago

遇到同样的问题,查了一下是/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 commented 4 years ago

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

imanoobtoo commented 4 years ago

遇到同样的问题,查了一下是/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 commented 4 years ago

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