The really, really minimalistic static site generator
- Separate key phrases (or everything, for that matter) into “modals” and localized content files.
- Create includes such as site-wide headers and footers to reduce repetition.
- Avoid copy and pasting the same content several times with global translations.
- Keep things simple with Mustache templates.
- Extend Ampersand with plugins written in Python.
Traditionally, managing translations of a website statically would look something like this:
__ root | |__ scripts | |__ scripts.js | |__ styles | |__ styles.css | |__ lang |__ en | |__ index.html | |__ about.html | |__ ... | |__ fr |__ index.html |__ about.html |__ ...
Here, we have a website with two or more English pages that we also translated into French. This works, but what happens when I want to make some changes to index.html? Now, I need to copy those changes over to the fr folder and adapt. When these phrases are wrapped with new UI components, It gets worse the more languages you add.
A problem like this would take a static site generator to solve, but not just any static site generator would do the trick. This generator must have a focus on translation, allowing you to build several copies of the same page based on different localization files.
Now, you can leave the translation to the globalization team and focus on your code.
So as you can tell, Ampersand is a pretty straightforward static site generator. Some may even argue that it doesn’t do much. This is because Ampersand is a minimalistic static site generator. But of course, all static site generators mention minimalism in their mission statement so saying it here doesn’t mean much. Never the less, Ampersand aims to do what it’s supposed to do without jumping through too many hoops that don’t help it achieve its goal.
Setting up Ampersand is fairly simple if you have pip. For those of you who don’t, python.org has it documented.
$ pip install ampersand
For a bleeding edge and developer version, you can clone the repository:
$ git clone https://github.com/natejms/ampersand.git $ cd ampersand $ pip install .
To learn more about the usage of Ampersand, check out the documentation
Interested in making a contribution? Here’s a few places where you might be able to help out:
- Contribute patches and help develop new features
- Develop a plugin for Ampersand
- Work to improve the documentation
- Help spread the word
More information can be found in the CONTRIBUTING.md file of this repository.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size ampersand-0.5.2-py2.py3-none-any.whl (11.8 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size ampersand-0.5.2.tar.gz (8.8 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for ampersand-0.5.2-py2.py3-none-any.whl