For context, I am integrating Strapi v4 as a headless cms / api with Jekyll 4.2.2 as a SSG.
I have got the plugin to work, but the permalinks doesn’t work for me. I am very new to Ruby programming.
Here is the code that needs updated: jekyll-strapi/site.rb at master · strapi/jekyll-strapi · GitHub
I think the :category, :title, etc… must be added to placeholders to work, but I am unsure what document is defined as because when I put :id as my permalink for Strapi, it doesn’t generate the id of the post like it should.
Ultimately, I want pretty permalink styles like this: /blog/:categories/:year/:month/:day/:title/
, but first I must have :id working.
url = Jekyll::URL.new(
:template => @config['strapi']['collections'][collection]['permalink'],
:placeholders => {
:id => document.id.to_s,
:uid => document.uid,
:slug => document.slug,
:type => document.type
}
)
This is my Strapi Jekyll config in _config.yml
# Strapi dashboard integration
strapi:
# Your API endpoint (optional, default to http://localhost:1337)
endpoint: https://api.example.com/api
# Collections, key is used to access in the strapi.collections
# template variable
collections:
# Example for a "posts" collection
posts:
# Collection name (optional). Used to construct the url requested. Example: type `foo` would generate the following url `http://localhost:1337/foo`.
type: posts
# Permalink used to generate the output files (eg. /posts/:id).
permalink: :id/
layout: post.html
output: true
authors:
type: authors
p.s. Strapi team in v4 does NOT maintain this repository anymore at this point in spacetime. I have spoke with them and they don’t program with Ruby.
If you are willing, maintaining this plugin would allow a larger audience to make use of Jekyll as part of the lifecycle of their workspace.