Git Product home page Git Product logo

kirby-astro-template's Introduction

Kirby Astro Template

A (plain) starter template for utilizing the flat file CMS Kirby headlessly alongside the SSG Astro on a single server.

Installation

  1. Create a .env file and specify the DOMAIN you want to publish as well as a DEPLOYMENT_KEY for security reasons:
DOMAIN="my-website.com"
DEPLOYMENT_KEY="my-secret-password"
  1. Install the Dependencies for Astro:

    1. cd frontend/
    2. (sudo) npm install
  2. (Optional): Give permission rights to your htdocs folder if using XAMPP or anything similiar:

sudo chmod -R 777 /path/to/XAMPP/xamppfiles/htdocs

Usage

The Kirby Panel is available at http://localhost/cms/panel/site

Since Kirby is installed in a subdirectory called cms, you can access the Kirby data with the prefix /cms. For example, the Kirby homepage data is available via http://localhost/cms. If you would create e.g. an about page , it would be available via http://localhost/cms/about and so forth.

The static files from Astro will be placed in the root directory. You can define your Astro pages as usual - if you need data from the CMS you just have to create a corresponding page and add this page to the page.ts definition:

// frontend/src/types/pages.ts
export enum Page {
    HOME = "/",
    ABOUT = "/about",
}

And to fetch the CMS data in Astro use the EnvironmentHelper:

// Example: Retrieving the HomePage
const response = await fetch(
    `${EnvironmentHelper.getFetchBaseURL()}${Page.HOME}`
);

// Example: Retrieving the AboutPage
const response = await fetch(
    `${EnvironmentHelper.getFetchBaseURL()}${Page.ABOUT}`
);

Deployment

KirbyCMS changes are deployed instantly. To deploy Astro Pages to the Page you can use the Deploy Button in the Kirby Panel which will generate the static assets and move the assets file to the root directory to make them available. The deployment secret is the secret which you specified in the .env file ($DEPLOYMENT_KEY).

Architecture Architecture Architecture

Architecture

Architecture

kirby-astro-template's People

Contributors

eder13 avatar

Watchers

 avatar  avatar

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.