Build websites with Python.

Quartos build websites. (This site is one.)

Scroll through these stanzas to see how it's done.


Copy this quarto.

A quarto project is four folders in a fifth folder:

Download the original stock quarto as a ZIP file or use it as a template:

github.com/samkennerly/quarto

Choose any name you want for your first quarto. Mine is bad-quarto.


Install some extras?

Python 3.6+ is required. Some features require extras:

Quartos do not need to be installed. To remove a quarto, delete it.


Rewrite the pages.

Any plain text editor can read and write pages, options, styles, and code.

Remove the stock pages.
Delete everything in the ready folder except these files:
ready/index.html
ready/index.json
Any change you might regret can be undone with git reset.
Write a new page.
Create ready/not_found.html with this text:
<h1>Error 404: Not To Be</h1>

<p>Ay, there's the point.</p>

<a href="https://github.com/samkennerly/quarto">
  <img alt="Quarto logo" src="media/quarto.svg" width="100%">
</a>
This page has a heading, a paragraph, and an image which links to the stock quarto.
Edit the home options.
Replace ready/index.json with this text:
{
  "base": "https://quarto.test/",
  "email": "",
  "homelink": "Bad Quarto",
  "meta": {
    "author": "Wm. Shakespeare",
    "description": "But, src! What links in yonder website break?"
  },
  "nextlink": "fore",
  "prevlink": "aft",
  "qlink": "Built badly by a quarto.",
  "styles": ["style.css"],
  "title": "Foul papers."
}
Options are optional. In this example, the email field is blank. (The Bard did not have Mail.)
Add some page options.
Create ready/not_found.json with this text:
{
  "meta": {
    "description": "No is the status of your GET request."
  },
  "title": "The Tragedy of Errors"
}
Missing values will be replaced with values from index.json.

Rebuild the site.

Open a terminal, cd to your quarto, and run these commands:

quarto/delete
Delete all pages and styles from the proof folder:
quarto/delete html && quarto/delete css
This will not delete any folders, icons, or cat pictures.
quarto/clean
Clean and overwrite HTML files in the ready folder:
quarto/clean
Keep your foul papers in another folder if you want to preserve them.
quarto/build
Read ready pages and write proof pages:
quarto/build
This script does not copy, delete, or move any files.
quarto/apply
Apply a style from the style folder:
quarto/apply style/celestial
This script finds CSS files recursively and cats them into one file.

Open proof/index.html in a browser to behold your brave new website.

Built badly by a quarto.