Learn how to spin up a site using Ghost as a headless CMS and build a completely custom front-end with the static site generator Gridsome.
http://localhost:8080/
in a browser and view the newly created Gridsome site.
gridsome.config.js
file:
baseUrl
value to the URL of your Ghost site. For Ghost(Pro) customers, this is the Ghost URL ending in .ghost.io
, and for people using the self-hosted version of Ghost, it’s the same URL used to access your site.
Next, update the contentKey
value to a key associated with the Ghost site. A key can be provided by creating an integration within the Ghost Admin. Navigate to Integrations and click “Add new integration”. Name the integration, something related like “Gridsome”, click create.
@gridsome/source-filesystem
plugin if you’re not planning on using Markdown files for your content.
Index.vue
file in /src/pages
of your project and replace the <page-query>
section with the following:
description
and coverImage
to excerpt
and feature_image
, which matches the data coming from the Ghost API.
Post.vue
file in /src/templates/
needs to be renamed to GhostPost.vue
.
Once this is done, replace the <page-query>
section in the template with the following:
http://localhost:8080/
in a web browser to see the result.
Tag.vue
template to GhostTag.vue
and replace the <page-query>
section with the following:
/tag/:slug
which will show all the posts filed under that tag.
/src/templates
called GhostAuthor.vue
. Use the following code within GhostAuthor.vue
:
/author/:slug
rendering all posts written by this author, along with their unmodified author image (if available) and name.
metaData
within the GraphQL schema. To retrieve that data use the following query: