Multiple Blogs In Single Jekyll Website

后端 未结 4 1854
后悔当初
后悔当初 2020-12-30 05:52

Is there a way I can have a single Jekyll website have more than one blog? I currently want to have two blogs in one site.

4条回答
  •  遥遥无期
    2020-12-30 06:22

    I am the author of the page http://www.garron.me/blog/multi-blog-site-jekyll.html

    Considering that you need individual archives pages, and latest post per individual blog. Just use something like this:

    Create a file archives-blog-1.html and fill it with:

    {% for post in site.posts %}
      {% if post.categories contains 'blog1' %}
        

    {{ post.title }}

    Date: {{ post.date }}

    {% endif %} {% endfor %}

    That will give you a list of all post in blog1, you can do the same for blog2. That page can be anyplace you want.

    For the latest post, you can use the same code but enclosed between:

    {% for post in site.posts limit:5 %}
    ....
    {% endfor %}
    

    That will give you the lastes 5 posts... I am using this

    {% for post in site.posts limit:5 %}
    
      
    {% endfor %}

    In my index page. http://www.garron.me/index.html ... under the sub-title (From the blogs) I am not limiting to any category, so posts from all blogs appear there, you can limit with {% if post.categories contains 'blog1' %}

    Hope it helps you.

提交回复
热议问题