Closed cedricdelpoux closed 7 years ago
There is also Prismic.io which offers the same service. Basically with this kind of service, you pull the content from the service and create markdown files before building. You can use this solution for a Wordpress based CMS too.
Looks amazing. I will take a look. Thanks
As a workaround for the content/ commit thing: you might be able to use 2 repos (one for content as a submodule).
For contentful you might want to check this https://gist.github.com/ivanoats/e79ebbd711831be2536d1650890055c4.
Closing as it's a duplicate of #886
Thank you. Sorry for the duplicate
Hi there, I know this issue is closed but I wanted to let you know that we support webhooks if you want to trigger ci builds to re-build you website everytime you publish something on Contentful.
@Khaledgarbaya do you have any tips to generate markdown files after requesting data from Contenful ?
@xuopled just download the data and generating a markdown file with frontmatter and a body.
I'm looking for a library which can help to create markdown file with frontmatter and body. Do you know one ?
@xuopled just write one yourself. Here is mine, only 30 LOCs https://github.com/thangngoc89/dnh-cpp/blob/6299e1d9b8d38e59568c1d5c2ee7b4a201ecec50/scripts/content/download-post.js
@xuopled Unfortunately there is no tool to do that, but as @thangngoc89 said should be straight forward to achieve that, Using the SDK client.getEntries({'content_type': 'post'})
and then run your files through a templating engine and save them. ps: the content_type:post
is just an example could be any contenttype you defined in the webapp. Also using the SDK you will get link resolution between reference entries included.
@thangngoc89, thank you, I did. @Khaledgarbaya I tried to create one markdown file per Contentful data :
client.getEntries()
.then(function(posts) {
posts.items.map(post => {
var mdContent = objectToYaml(post.fields)
fs.outputFile(`content/${post.fields.slug}.md`, mdContent)
})
})
but some of my fields are reference to other data :
---
title: Down the Rabbit Hole
slug: down-the-rabbit-hole
author:
- &ref_0
sys:
space:
sys:
type: Link
linkType: Space
id: wdrlqiaj0bs4
fields:
name: Lewis Carroll
---
Is there a way to configure the way some ref will be resolve ?
For example I would like the author field will resolve to author.fields.name
to get :
---
title: Down the Rabbit Hole
slug: down-the-rabbit-hole
author: Lewis Carroll
---
@xuopled write you own resolver here
var mdContent = objectToYaml(post.fields)
I would like to create a generic plugin. If each people has to resolve everything by hand, it would be never easy for Phenomic users to use it
@xuopled that's the goal for 1.0 . With the current architecture, it's hard to do that.
Ok So I stop wasting my time :D
@xuopled the SDK should do the resolution for you, how deep the links are? and to not spam this issue can you create an issue here
I don't know if my explanation is good but I opened an issue : https://github.com/contentful/contentful.js/issues/119
I just discovered Contentful. Contrary to
Netlify-cms
orSiteleaf
this service does not push to github repo.Do you think it could be possible, during the build process, to get content from
Contentful
to generate static website ?I could be awesome. Because for now, I use
Siteleaf
and I let someone write content for me. But for each updated file, the is a commit. I would like to keep my git history clean and maybeContentful
could be a solution. What do you think ?