On macOS you will need to add /Applications/Racket\ 7.0/bin (or similar) to your PATH in order to be able to run things like racket or raco at the command line.
- Install Frog:
$ raco pkg install frog
Optional: If you want syntax highlighting for fenced code blocks:
To update Frog and its dependencies:
$ raco pkg update --update-deps frog
Creating a new blog project is 3 easy steps:
- Create a subdirectory.
$ mkdir frog-project
- Go there.
$ cd frog-project
- Tell Frog to create default files and directories.
$ raco frog --init
Creating files in /tmp/frog-project/:
Project ready. Try `raco frog -bp` to build and preview.
You can go ahead and build/preview this to get a feel for the default starting point:
$ raco frog -bp
Launching /usr/bin/python pipe.py
Your Web application is running at http://localhost:3000/index.html.
Stop this program at any time to terminate the Web Server.
Web Server stopped.
Here is the file tree that raco frog --init creates for you and Frog expects:
# Files provided by you:
frog.rkt # frog.rkt
page-template.html # entire page layout: Page template
post-template.html # <article> layout: Post template
index-template.html # index pages: Index template
# You’ll create these using raco frog -n <post-title>
# Zero or more other .md files, for non-post pages.
# May be in subdirs.
bootstrap.min.css # get these files
bootstrap.min.css.map # from https://getbootstrap.com
pygments.css # style code elements from Pygments
custom.css # other styles you provide; may be empty
jquery-3.2.1.slim.min.js # local copy of jQuery for Bootstrap
bootstrap.bundle.min.js # from https://getbootstrap.com/
Here are the files created by Frog when you run raco frog -b to (re)build the blog:
.frog/build # a cache to support minimal rebuilds
# Post pages are in subdirs.
Although the Frog example project has copies for example purposes, for your own project you should get the official/latest Bootstrap 4 files directly from Bootstrap.
For examples of "pygments.css" code highlighting styles see https://github.com/richleland/pygments-css.
When you used raco frog --init it created a "frog.rkt" file in your project directory. If you upgrade from an older version of Frog that used a ".frogrc" file: The first time the newer version of Frog runs, it automatically creates an equivalent "frog.rkt" from your ".frogrc". Thereafter the ".frogrc" is ignored, and may be deleted.
Your "frog.rkt" lets you use simple Racket code to configure and customize your blog.
|#lang frog/config||package: frog|
Furthermore, the frog/config language ensures that you define three functions that are used by Frog:
(init) → any
You can set various parameters provided by frog/params. To start, you might only need to set a few:
(clean) → any
A typical workflow:
1. Create a new post with raco frog -n "My Post Title". The name of the new .md file is displayed to stdout.
2. Edit the .md file in your preferred plain text editor.
3. Regenerate your site and preview it with raco frog -bp. (You might repeat steps 2 and 3 a few times until you’re satisfied.)
4. Deploy. If you’re using GitHub Pages, you can commit and push to update your site. If you’re using some other method, you can copy or rsync the files to your static file server.