Code Monkey home page Code Monkey logo

neon's Introduction

Neon

Neon is a static site generator built by me and for me.

Install

To install, you must have the Go toolchain installed at version 1.11 or later.

  1. go build (or GO111MODULE=on go build if you've cloned this directory into your $GOPATH)
  2. mv ./neon $SOMEWHERE_IN_PATH

Usage

Initializing a neon project

Neon projects have a file called neon.yaml in their root. Neon commands run in any subdirectory of the project root will be run against the project. The neon.yaml file for my blog currently looks like this (check out ./config/config.go for marginally more information about the configuration options):

theme: default
live_reload_port: 8081
title: Craig Weber
description: "My blog; mostly tech"
author: Craig Weber
theme_config: # these params are only passed into the theme templates
  site_title: Craig Weber
  copyright: Craig Weber 2016
  contact:
    - url: http://twitter.com/weberc2
      text: Twitter
    - url: http://github.com/weberc2
      text: Github
  analytics_url: https://azd7mnx3pk.execute-api.us-east-2.amazonaws.com
index_page_size: 10
site_root: https://weberc2.github.io
code_highlight_theme: friendly

Ok, now we have our neon.yaml file--we should also make a ./posts directory with our posts represented as individual markdown files. These markdown files should have some frontmatter, such as:

---
Title: Deploying Go apps on Docker scratch images
Date: 2018-11-04
---

Title and Date are pretty important, but you can hang other metadata off of this too.

Lastly, you should have a ./themes directory with your themes. You can start by checking out ./themes/mono. Themes are just Go templates. The theme_config from the neon.yaml file gets passed, so you have to make sure the theme_config is populated as required by the theme.

Building a neon project

Ok, so now that we've initialized a neon project, we should try to build it. That much is easy, it's just neon build from anywhere in project. This will create an $NEON_PROJECT_ROOT/_output/ directory if none exists and dump the files there. Note that if the output directory already exists, neon build will overwrite files, but it will not delete any deleted or renamed posts. In lieu of that, the best practice is to delete the whole output directory before running neon build.

Deploying the output directory

The output directory is ready-to-serve. Because I deploy to BitBucket pages (a git repo), I just rm -r $TARGET_REPO_ROOT/* followed by cp -r $NEON_PROJECT_ROOT/* $TARGET_REPO_ROOT and then I push the repo to publish it.

Iterating with neon serve

Running neon serve in your project directory will run a local development server on port 8080. This is not a production server. It takes a --port flag if you want to override the default port.

neon's People

Contributors

weberc2 avatar weberc2-tempus avatar

Watchers

 avatar  avatar

neon's Issues

Improve README

README should succinctly cover:

  • Building
  • Installation
  • Usage
    • neon build
    • neon serve
    • configuration
      • Link to godoc config.Config struct for details (so as to avoid having to keep the docs up to date with the struct)
      • Link to blog/neon.yaml for an example
  • Contributing

Linkable Headings

There should be anchors in the generated HTML headings such that consumers of the generated HTML can create links to individual headings.

Releases for master no longer work

It looks like the Github release action is tagging all releases as master instead of some unique identifier, causing subsequent runs to fail.

Posts shouldn't have to add extra `#`s to each heading

Today, because my blog theme makes the blog title an <h1>, and the titles <h2>, headings in my blog content must begin with ### to render as <h3>. In order to decouple the markdown source from the details of the theme, the markdown source should be able to start headings with # and neon should coordinate with the theme to figure out the appropriate HTML heading tag to begin with.

Neon should support tags

I should be able to tag my posts such that I can click on the tag in the rendered HTML and it will send me to an index page filtered to posts with that tag.

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.