Jekyll 24小时制作时间?

时间:2017-11-19 04:27:28

标签: jekyll

我想通过26k帖子将社区博客移至Jekyll。每天至少有5/6个新帖子我们要发布。首先,我尝试了500个帖子,所以一切都很棒,但现在看起来有些不对劲或者Jekyll不适合我的要求。有没有办法更快地构建它? Jekyll对26k或更多网站的最佳做法是什么?

$ jekyll build --profile
fatal: Not a git repository (or any of the parent directories): .git
Configuration file: /Users/****/Desktop/Blog/test/jekyll/mysite/_config.yml
            Source: /Users/****/Desktop/Blog/test/jekyll/mysite
       Destination: /Users/****/Desktop/Blog/test/jekyll/mysite/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 

Filename                                                                                            | Count |       Bytes |      Time
----------------------------------------------------------------------------------------------------+-------+-------------+----------
_includes/sidebar.html                                                                              | 23324 | 2428672.65K | 68515.572
_layouts/default.html                                                                               | 21330 | 2384451.87K | 66784.726
_includes/sidebar-icon-links.html                                                                   | 23324 |   92088.80K | 39129.854
_includes/sidebar-nav-links.html                                                                    | 23324 | 2320100.26K | 29357.133
_layouts/post.html                                                                                  | 17769 |   67024.01K | 18833.855
_includes/post-tags.html                                                                            | 17769 |     869.13K | 18813.715
_includes/page-links.html                                                                           | 23324 | 1156884.07K | 17997.675
_includes/category-links.html                                                                       | 23324 | 1159321.26K | 11325.112
_layouts/day-archive.html                                                                           |  1860 |  199476.16K |  1649.141
_layouts/month-archive.html                                                                         |   122 |   16533.29K |   121.753
_layouts/index.html                                                                                 |  3554 |   69096.50K |    87.228
_includes/head.html                                                                                 | 23324 |   22678.52K |    25.691
_layouts/year-archive.html                                                                          |    12 |    4954.47K |    11.302
_includes/post-meta.html                                                                            | 21323 |    4268.72K |    11.221
_layouts/tags.html                                                                                  |     1 |     193.33K |     4.362
_includes/tags-list.html                                                                            |     1 |     193.33K |     4.359
_includes/copyright.html                                                                            | 23324 |    1480.53K |     3.962
_includes/google-analytics.html                                                                     | 23324 |      22.78K |     3.389
_includes/favicons.html                                                                             | 23324 |    2915.50K |     2.486
_includes/font-includes.html                                                                        | 23324 |    2004.41K |     1.205
_includes/svg/tags.svg                                                                              | 23832 |    6888.94K |     1.128
_includes/custom-nav-links.html                                                                     | 23324 |    1343.86K |     1.047
_includes/svg/github.svg                                                                            | 23324 |   44233.60K |     0.915
_includes/pagination-older.html                                                                     |  3554 |     377.12K |     0.753
_includes/svg/search.svg                                                                            | 23324 |    9065.38K |     0.684
_includes/svg/back-arrow.svg                                                                        | 23323 |    5010.80K |     0.678
archive/index.html                                                                                  |     1 |    2626.28K |     0.666
_includes/svg/download.svg                                                                          | 23324 |    4669.36K |     0.632
_includes/svg/feed.svg                                                                              | 23324 |    8040.40K |     0.629
_includes/custom-head.html                                                                          | 23324 |    3097.72K |     0.627
_includes/custom-icon-links.html                                                                    | 23324 |    1366.64K |     0.595
_includes/custom-foot.html                                                                          | 21330 |     687.39K |     0.577
_includes/pagination-newer.html                                                                     |  3554 |     377.12K |     0.553
feed.xml                                                                                            |     1 |     383.78K |     0.225
_posts/2006-03-26-*****************************************.markdown                                |     1 |       5.02K |     0.054
_layouts/category.html                                                                              |     2 |       1.19K |     0.034
_posts/2005-04-07-*******************************************************.markdown                  |     1 |      28.51K |     0.015
_posts/2006-07-23-**************************.markdown                                               |     1 |       5.68K |     0.012

                    done in 87758.356 seconds.
 Auto-regeneration: disabled. Use --watch to enable.

1 个答案:

答案 0 :(得分:2)

第一个(也是显而易见的)建议:至少避免或减少代码中的O(n)循环。

然后从您的统计数据中重复使用includes,您可以使用https://github.com/benbalter/jekyll-include-cache从文档中获取更多内容:

  

如果你有一个计算上昂贵的包括(如侧边栏或   导航),Jekyll Include Cache渲染包含一次,然后   在使用相同的方式调用包含的任何时候重用输出   争论,可能会大大加快您网站的构建速度。