【问题标题】:Copy static files from one Jekyll post to published site将 Jekyll 帖子中的静态文件复制到已发布的站点
【发布时间】:2016-06-28 15:50:11
【问题描述】:

我想将在_posts 内的帖子文件夹中找到的任何静态文件(图像、PDF 等)复制到 _site 内的帖子的 HTML 版本所在的文件夹。

假设我有这个结构:

_posts/
  2016/
    06/
      09-so-long-cloudflare/
        2016-06-09-so-long-cloudflare-and-thanks-for-all-the-fissh.md
        cloudflare-logo.png
        performance-report-sample.pdf

我对永久链接的 Jekyll 设置是:

# Permalinks
permalink: /:year/:month/:day/:title/

我想生成这样的网站:

2016/
  06/
    09/
      so-long-cloudflare-and-thanks-for-all-the-fissh/
        index.html
        cloudflare-logo.png
        performance-report-sample.pdf

我发现 this plugin 应该这样做,但我不能让它工作。我收到此错误:

jekyll 3.1.6 | Error:  undefined method `name' for #<Jekyll::Document:0x007fb7a0892b50>

有什么想法吗?

谢谢!

【问题讨论】:

    标签: file static jekyll jekyll-extensions


    【解决方案1】:

    好吧,尽管没有 Ruby 知识,我还是设法用 this old Gist 构建了一个插件! \o/

    https://nhoizey.github.io/jekyll_post_files/

    我希望这会帮助有相同需求的人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-08-26
      • 2013-11-19
      • 2021-05-21
      • 1970-01-01
      • 2015-03-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多