问题
After ditching Wordpress, I've been experimenting with Jekyll to create a blog. I chose it (over Ghost) to help learn the basics of web development while I blogged. Also, the free hosting on GitHub Pages is neat and free.
What exactly is a static site generator (like Jekyll), and why do they exist?
回答1:
From Build a Blog with Jekyll and GitHub Pages course on Treehouse:
A static-site generator takes a set of templates and raw text files, runs it through a converter and renderer, then generates a plain HTML website that's ready to publish on any web server.
Advantages:
- Sites load fast since we're serving regular pages to the browser and don't need to talk to a database on each request.
- Sites are more secure because there's no database or dynamic content that can be hacked.
- Less maintenance involved. No database means no need to configure and maintain a database or content management system (CMS).
- Free hosting on GitHub Pages
- Use your own domain name
Course Link: https://teamtreehouse.com/library/build-a-blog-with-jekyll-and-github-pages
回答2:
A static site has 3 components:
- HTML files (or other content to serve via the web, like .txt files)
- referenced assets (js, images, css)
- a web server
There is no database from which data is retrieved, compared to something like wordpress where all of your posts and pages live in a database. There is no server-side scripting engine with which to process information and render content.
Static site generators exist to provide you with tools like templating, shared data, and custom tags to assist in the creation of the static HTML pages that your web server will be serving.
The benefits of a static site are:
- Security. The web server is the only moving part.
- Portability. The HTML files will render the same when served from your local machine as they will on the web.
- Speed. When almost everything is cacheable, compressed, and doesn't require any data crunching, things load very fast.
来源:https://stackoverflow.com/questions/30181349/what-is-a-static-site-generator