makeweb

package module
v0.0.0-...-c463d41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2019 License: MIT Imports: 12 Imported by: 0

README

Makeweb

Static site generator designed to be simple to use, but also powerful.

Install

go get github.com/PaperMountainStudio/makeweb-cli

Advantages

  • fast
  • cheap
  • secure
  • flexible
  • easy to edit
  • easy to migrate

Usage

mkdir ~/makeweb_example
cd ~/makeweb_example
mkdir input
mkdir templates
touch input/index.html templates/default

Now you have created basic project structure. Open input/index.html in your editor and write:

{
    "title": "Makeweb example"
}
---
content

This is your webpage content, but we also need a template. Open templates/default and write:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <title>{{.title}}</title>
  </head>
  <body>
  {{.text}}
  </body>
</html>

As you can see, we use {{.title}} to get title we specified in webpage content's header. The {{.text}} is a special case, this is substituted by the content of webpage - in our case input/index.html after the ---.

Now everything is ready, you can generate it.

makeweb-cli

We can see that a new directory output has been created. That is where our generated webpage is. If you have python3 installed, you can use this to serve it:

cd output
python3 -m http.server

And type localhost:8000 to your browser. You should see the generated webpage.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyMap

func CopyMap(m map[string]interface{}) map[string]interface{}

func Execute

func Execute() error

Types

type Page

type Page struct {
	Vars    map[string]interface{}
	Content string
	Path    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL