Git Product home page Git Product logo

astro-ghost-cms's Introduction

Static Site with Headless Ghost (Casper theme) + Astro

This showcases how to use Ghost Content API as a headless CMS, using Astro as the frontend framework.

Check out the article on how this site was created here.

Getting started

You should have a Ghost instance up and ready to get the API Credentials.

Clone .env.example to .env.local in the same directory, and add the following:

GHOST_CONTENT_API_URL=your_ghost_content_api_url
GHOST_CONTENT_API_KEY=your_ghost_content_api_key
SITE_URL=http://localhost:3000

Add your production url in Astro config under the site key.

export default defineConfig({
  site: 'https://my-website.com',
  ...
});

Theme Configuration

Theme settings are not exposed by Ghost Content API. You will have to manually set options for our Casper theme in utils/theme.config.ts. These should mirror your settings in your Ghost instance, under Settings > Design. Refer to the interface CasperThemeOptions for the values.

const customOptions: Partial<CasperThemeOptions> = {
  body_font: 'Modern sans-serif',
  show_publication_cover: false,
  feed_layout: 'Classic',
  color_scheme: 'Dark',
};

๐Ÿงž Commands

This project prefers the yarn package manager. All commands are run from the root of the project, from a terminal:

Command Action
yarn install Installs dependencies
yarn start Starts local dev server at localhost:3000
yarn build Build your production site to ./dist/
yarn preview Preview your build locally, before deploying
yarn astro ... Run CLI commands like astro add, astro preview
yarn astro --help Get help using the Astro CLI

N.B.

In this showcase, the design is based on the Casper theme, and is converted into js/ts from the theme's handlebars templates, which might not reflect the changes in the latest version.

It is recommended that you implement your own design for your site. If you wish to continue using the Casper theme for production, you should update the markup by referencing the latest source code at https://github.com/TryGhost/Casper.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.