GithubHelp home page GithubHelp logo

wini3d / mini Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vincenttam/teststaticmanlab

0.0 0.0 0.0 62 KB

Minimal Jekyll site running Staticman v3 served by @staticmanlab.

Home Page: https://git.io/smdemo

License: The Unlicense

HTML 100.00%

mini's Introduction

Test Staticman Lab

Minimal GitHub static site powered by Jekyll, served by @staticmanlab running on Staticman.

  • demonstrate how Staticman v3 works with Jekyll.
  • facilitate other developers to change my repo. (e.g. add CSS)

Minimal setup

Clone this repo.

git clone https://github.com/VincentTam/TestStaticmanLab.git <your-site-name>

Remove existing comments under the folder _data and the public domain license in file LICENSE. Then modify the following fields in the Jekyll config file _config.yml.

# Site settings
title: Your title
subtitle: Optional subtitle
url: "https://<username>.github.io/<repo>/"

staticman:
  api: "https://staticman3.herokuapp.com/v3/entry/github/<username>/<repo>/<branchname>/<propertyname>"
  path: "_data/comments/test-slug"

I hardcoded test-slug in _config.yml, index.html and _includes/comments.html. The property name defaults to comments.

By default, comments are sent to the GitHub repo as pull requests because of the moderation parameter in staticman.yml.

  moderation: true

Changing it to false will enable automatic merge.

Finally, make your Git repo available on GitHub and invite @staticmanlab as a collaborator. Enter the URL

https://staticman3.herokuapp.com/v3/connect/github/<username>/<repo>

so that @staticmanlab can accept your invitation and start delivering comments to your site.

Minimal site infrastructure

The source code for this Jekyll site is made up of six pieces. The infrastructure follows Popcorn, Staticman's official demo.

  1. Homepage: index.html
  • contain the HTML form (copied from Staticman's guide) which sends a POST request to the api specified in _config.yml.
  • outsource HTML code for comment display to _includes/comments.html so as to allow reader's to focus on the HTML form, which is the main focus of this project
  • outsource wrapping HTML code to _layouts/default.html
  1. Generated comments: _data/<propertyname>/<slug>/entry-<timestamp>.yml
  • store static site comments as Jekyll site data
  • file/path creation is handled by Staticman's API
  1. Comment renderer: _includes/comments.html
  • Retrieve Jekyll site data
  • Wrap each field with suitable HTML tag and class(es)
  1. Staticman config file: staticman.yml
  • root-level file, keep the file name
  • contain configurations for comment delivery to the GitHub repo
  • only responsible for logical side
    • e.g. generate the MD5 hash of commentator's email
    • not responsible for comment display/site layout
  1. Jekyll config file: _config.yml
  • Present in every static site generator under a similar name and format
  • Store site config parameters so as to facilitate site setup by avoiding hardcoding. Some important parameters include
    • title: site name
    • staticman.api: hook up the HTML form with Staticman's API server's "/entry" endpoint
  1. Page layout: _layouts/default.html
  • contain necessary HTML code that wraps the form
  • display the site title and the optional subtitle supplied in _config.yml
  • add license
  • link to W3C's HTML validator for HTML validation in two clicks.

mini's People

Contributors

staticmanlab avatar tatimblin avatar vincenttam avatar wini3d 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.