【问题标题】:Is it possible to validate if a link (or string) matches with any valid Jekyll permalink?是否可以验证链接(或字符串)是否与任何有效的 Jekyll 永久链接匹配?
【发布时间】:2018-07-13 14:45:59
【问题描述】:

是否可以验证链接(或字符串)是否与任何有效的 Jekyll 永久链接匹配?

例如,我正在动态生成这样的导航栏:

<li class="active">
  <a href="{{ base }}/{{ site.locale }}/about/the-project/">About</a>
</li>

现在,是否有可能知道“{{ base }}/{{ site.locale }}/about/the-project/”是否是有效的永久链接?

如果链接与任何有效的永久链接都不匹配,我们的想法是跳过那个“LI”标签。

【问题讨论】:

    标签: jekyll liquid permalinks jekyll-extensions


    【解决方案1】:

    所以,我基本上使用的是我的站点地图。

    {% assign tmp_posts = site.posts | where:'locale', site.locale %}
    {% assign tmp_buildlogs = site.buildlog | where:'locale', site.locale %}
    {% assign all_posts = tmp_posts | concat: tmp_buildlogs %}
    

    然后,我可以检查链接。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-21
      • 2011-11-27
      • 2012-02-21
      相关资源
      最近更新 更多