A plugin is responsible for generating web pages. They may uses various services to do this as well as it’s configuration (defined within /config.ts
). There are a few plugins built into StaticGenie;
This is at the heart of StaticGenie. It’s a simple model -> view setup and hence, creates a basic page.
Create your page within /data/standardpage
and name your file with the .md
extension e.g. /data/standardpage/about.md
. This page will contain all the data for the specific page.
The .md
file is broken down into 2 halves. The HEAD section which uses yaml syntax & the BODY part (everything below =====) which uses markdown syntax.
The first part of the file looks like this:
###########################################
# HEAD
###########################################
config:
layout: standardpage
file: /about/index.html
page:
key: value
The config:
section is used by the plugin and not made available to the themes layouts
The page:
section is passed directly to the theme layout where the theme can render the bespoke data specifically when building that page
The BODY section looks like this:
###########################################
# BODY
###########################################
=====
# Heading here...
Everything below the =====
will be rendered as markdown and made available to the theme layout via the key page.content
. If you try to define a page.content
key within the HEAD section of the page it will error. Since page.content
is reserved for use by the BODY of the page.
Page /data/standardpage/about.md
###########################################
# HEAD
###########################################
config:
layout: standardpage
file: /about.html
page:
###########################################
# BODY
###########################################
=====
# About
About text here...
Run StaticGenie docker-compose run --service-ports sg npm start
and load up http://127.0.0.1:8080/about.html
. The generated website will be in /www
.
Check the Roadmap for more information on the development of this plugin.
In the event you want something more elaborate. Such as pulling data from a 3rd party resource and building pages based on such data. Read more about creating a plugin