Giter Club home page Giter Club logo

vcl-static-site-generator's Introduction

Kate's static website generator

I don't want to run a web server because my sites are such low traffic that they'd always be absent from cache, and need fetching every time. But code is free, so I made a static site generator to convert a directory of files to a VCL table, and index it by URL.

This isn't a generator so much as an uploader. You need to provide your own directory of files.

Features

  • 404 page
  • Default to /index.html
  • Binary content not supported
  • You need <base href="..."/>

What to do

  1. Make a service, make an API key for that service
  2. Make a non-dynamic snippet for main.vcl
  3. Create a dynamic snippet for the data:
; export SID= # service ID
; export KEY= # API key
; export VER= # unlocked (not yet activated) version
; curl -X POST -s https://api.fastly.com/service/$SID/version/$VER/snippet \
  -H "Fastly-Key:$KEY" -H 'Content-Type: application/x-www-form-urlencoded' \
  --data $'name=data&type=init&dynamic=1&content=table body {}\n'
{"name":"synth","type":"init","dynamic":1,"content":null,"service_id":"...",
 "version":"...","deleted_at":null,"id":"...","updated_at":"...","priority":100,
 "created_at":"..."}

Remember the snippet ID there - you'll need it for updates.

  1. Activate the service
  2. Update whenever you feel like it:
; KEY=... SID=... SNIPPET=... ./update.sh /path/to/htdocs

FAQ

Q. Why not use edge dictionaries?
A. The API doesn't provide a “replace everything in one go” operation. Also they render to VCL anyway; here I can generate the same VCL in the first place.

vcl-static-site-generator's People

Contributors

jakechampion avatar katef 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.