No commit activity in last 3 years
No release in over 3 years
A Custom Jekyll plugin for retrieving content from a Strapi API for Latest Jekyll Versions
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 3.2
>= 0
~> 2.1
 Project Readme

jekyll-strapi

Install

This is a Custom Jekyll-strapi gem for Use in Jekyll version > 4.0. Since the Official jekyll-strapi gem has not been developed for the past 2 years. I Forked it and Made some Changes to Work with Latest Jekyll Versions.

Add the following to your Gemfile:

gem "jekyll-strapi", github:tks18/jekyll-strapi

Then add "jekyll-strapi" to your plugins in _config.yml:

plugins:
    - jekyll-strapi

Configuration

strapi:
    # Your API endpoint (optional, default to http://localhost:1337)
    endpoint: http://localhost:1337
    # Collections, key is used to access in the strapi.collections
    # template variable
    collections:
        # Example for a "articles" collection
        articles:         
            # Collection name (optional)
            type: article
            # Permalink used to generate the output files (eg. /articles/:id).
            permalink: /articles/:id/
            # Layout file for this collection
            layout: strapi_article.html
            # Generate output files or not (default: false)
            output: true

Usage

This plugin provides the strapi template variable. This template provides access to the collections defined in the configuration.

Using Collections

Collections are accessed by their name in strapi.collections. The articles collections is available at strapi.collections.articles.

To list all documents of the collection:

{% for post in strapi.collections.articles %}
<article>
    <header>
        {{ post.title }}
    </header>
    <div class="body">
        {{ post.content }}
    </div>
</article>
{% endfor %}