静态站点生成器 Static Site Generator
被数据库支持的数据，比如评论，sessions等，只能通过第三方服务支持。如果你现在一个静态网站上使用评论，你需要嵌入embed Disqus’s form并完全依赖他们的服务。
- Pelican 是一个常用的Python静态站点生成器。主要模板引擎是Jinja，Markdown，reStructuredText and AsciiDoc。
- Lektor 是一个静态内容管理系统和静态站点生成器，它使用Jinja作为模板引擎。
- Nikola (source code) 整合了reStructuredText，Markdown或Jupyter (IPython) Notebooks，以Mako或Jinja2模板生产静态站点。
- Acrylamid (source code) uses incremental builds to generate static sites faster than recreating every page after each change is made to the input files.
- Hyde (source code) started out as a Python rewrite of the popular Ruby-based Jekyll static site generator. Today the project has moved past those “clone Jekyll” origins. Hyde supports Jinja as well as other templating languages and places more emphasis on metadata within the markup files to instruct the generator how to produce the output files. Check out the Hyde-powered websites page to see live examples created with Hyde.
- Grow SDK (source code) uses projects, known as pods, which contain a specific file and directory structure so the site can be generated. The project remains in the “experimental” phase.
- Complexity (source code) is a site generator for users who like to work in HTML. It uses HTML for templating but has some functionality from Jinja for inheritance. Works with Python 2.6+, 3.3+ and PyPy.
- Cactus (source code) uses the Django templating engine that was originally built with front-end designers in mind. It works with both Python 2.x and 3.x.
- This site is all open source in its own GitHub repository under the MIT license. Fork away!
- Django REST Framework uses MkDocs to create its documentation site. Be sure to take a look at the mkdocs.yml file to see how large, well-written docs are structured for that project.
- Practicing web development uses Acrylamid to create its site. The code is open source on GitHub.
- Linux Open Admin Days (Loadsys) has their site open source and available for viewing.
- The Pythonic Perambulations blog has a fairly standard theme but is also open source on GitHub.
Static site generators can be implemented in any programming language. The following resources either are general to any programming ecosystem or provide a unique angle on how to use a static site generator.
- Static vs Dynamic Websites does an excellent job of showing the differences between a dynamic website that uses a database backend to produce content in response to a request compared with static sites that are pregenerated. There is also a second part in the series where generic static site generator concepts are explained.
- Staticgen lists static website generators of all programming languages sorted by various attributes such as the number of GitHub stars, forks and issues.
- The title is a big grandiose, but there’s some solid detail in this article on why static website generators are the next big thing. I’d argue static website generators have been big for a long time now.
- Static site generators can be used for a range of websites from side projects up to big sites. This blog post by WeWork on why they use a static site generator explains it from the perspective of a large business.
- Ditching WordPress and becoming one of the cool kids is one developer’s experience moving away from WordPress and onto Pelican with reStructuredText for his personal blog.
- Static websites with Flask explains how to use Flask-Frozen to generate a static site based on content from the web framework and a data source backend. This approach is an alternative to using a purpose-built static website generator such as Pelican, Lektor or MkDocs.
Deploying a static site is far less complicated than a traditional web application deployment, but you still need to host the files somewhere accessible. You’ll also to set up DNS to point a domain name to your site as well as provide HTTPS support. These guides walk through various ways of handling the static site deployment.
- Randall Degges’ Ultimate Guide to Deploying Static Sites to Amazon Web Services walks through all the steps you need to get your site up and running on S3. The guide also shows how to set up SSL certificates to ensure your site can be loaded via HTTPS.
- Deploying a Static Site on AWS, with S3 and CloudFront provides a really nice tutorial with screenshots to get any type of static site configured on AWS using S3 and Cloudfront.
- Static site hosting with S3 and Cloudflare shows how to set up an S3 bucket with Cloudflare in front as a CDN that serves the content with HTTPS. You should be able to accomplish roughly the same situation with Amazon Cloudfront, but as a Cloudflare user I like their service for these static site configurations.
- Google Cloud provides a tutorial on how to use them to host your static site. Note that you cannot currently use HTTPS on Google Storage servers, which is a huge downside.