HUGO

Using Ghost as a headless CMS with Hugo

Hi,

I’m currently trying to figure out the best approach to use Ghost as a headless CMS to render a static page via Hugo.

So far I found Data Templates, which allow to pull content from a given URL. The following snippet allows me to render a list of all posts:

<ul>
    {{ $urlPre := "https://<hostname>" }}
    {{ $urlKey := "/?key=<api-key>" }}
    {{ $json := getJSON $urlPre "/ghost/api/v3/content/posts" $urlKey }}

    {{ range $json.posts | first 10 }}
     <li><a href="{{ .url }}" target="_blank">{{ .title }}</a></li>
    {{ end }}
</ul>

But what is the best approach to render the actual posts? Is there any chance to “configure” the content of the Hugo Posts? Currently I’m just linking to the Ghost posts, which is not exactly what I intended :wink:

Any hints appreciated!

Kind regards,
Christoph

It’s coming: https://github.com/gohugoio/hugo/issues/6310 :slight_smile:

4 Likes

Thats good news, thank you!
Though I hoped it is already possible - reading about all the “JAM”-Buzz lead me to this assumption^^’