Code Monkey home page Code Monkey logo

site-gen's Introduction

site-gen

A simple site generator that converts markdown files (.md) to HTML in situe, using a given template.

Built and previously used for my website. Subsenquently replaced by site-gen-rust (see other repo).

Requirements

  • Swift 5.8
  • Xcode 14.3

Build

from terminal

make

Template

Example template.html

<!DOCTYPE html>
<html lang="en">

<head>
    <title>{{%%title%%}}</title>
    <meta name="Description" content="{{%%description%%}}"/>
    <meta name="Keywords" content="{{%%keywords%%}}"/>
</head>

<body>
    {{%%content%%}}
</body>
</html>

Metadata

Alongside the markdown file, you must provide a meta.json (or named different, see metadatafilename in the settings) containing the information required for the production of the page.

These are to be used in the header of the HTML.

{
	"title": "Boomdeck",
	"description": "Opiniated Music and Radio Player for macOS",
	"keywords": [
		"MacOS", "Web Radio player", "MP3", "Player", "WAV", "aiff", "Radios", "Swift", "SwiftUI"
	]
}

Settings

a .settings.json file is required along side the executable, e.g.

{
    "workdir": "/Users/User/Documents/path/to/website",
    "metadatafilename": "meta.json",
    "template": "templates/template.html",
    "contenttag": "{{%%content%%}}",
    "titletag": "{{%%title%%}}",
    "descriptiontag" : "{{%%description%%}}",
    "keywordstag": "{{%%keywords%%}}"
}

Execution

./sitegen

The site generator will look from the workdir recursively, through every folder and convert and found markdown file (.md) to an HTML so as long as a meta.json is found along with it.

NOTE, by default, it will look for .settings.json, but a different settings.json can be provided as parameter: ./sitegen different.json

site-gen's People

Contributors

keyle 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.