1 Quick start
1.1 Installing Frog
Install Racket.
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:
1.2 Updating Frog
To update Frog and its dependencies:
$ raco pkg update --update-deps frog
1.3 Starting a new blog project
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/:
/tmp/frog-project/frog.rkt
/tmp/frog-project/_src/About.md
/tmp/frog-project/_src/page-template.html
/tmp/frog-project/_src/post-template.html
/tmp/frog-project/_src/posts/2012-01-01-a-2012-blog-post.md
/tmp/frog-project/css/
/tmp/frog-project/js/
/tmp/frog-project/img/
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
Frog 0.26
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.
C-c C-c
Web Server stopped.
1.3.1 Project file tree
Here is the file tree that raco frog --init creates for you and Frog expects:
project/
# Files provided by you:
frog.rkt # frog.rkt
_src/ # default; see current-source-dir in frog.rkt
page-template.html # entire page layout: Page template
post-template.html # <article> layout: Post template
index-template.html # index pages: Index template
posts/
# You’ll create these using raco frog -n <post-title>
2013-01-01-a-blog-post.md
2013-02-15-another-blog-post.md
...
# Zero or more other .md files, for non-post pages.
# May be in subdirs.
css/
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
scribble.css
js/
jquery-3.2.1.slim.min.js # local copy of jQuery for Bootstrap
bootstrap.bundle.min.js # from https://getbootstrap.com/
img/
feed.png
favicon.ico
Here are the files created by Frog when you run raco frog -b to (re)build the blog:
project/ # default; see current-output-dir in frog.rkt
.frog/build # a cache to support minimal rebuilds
index*.html
sitemap.txt
tags/
feeds/
# Post pages are in subdirs.
# Exact layout depends on current-permalink in frog.rkt.
blog/
2013/
01/
a-blog-post-title/
index.html
...
2013/
02/
another-blog-post-title/
index.html
...
...
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.
To design a Bootstrap 4 "theme", try Bootstrap Magic. Also, http://bootswatch.com/ has some ready-made themes.
For examples of "pygments.css" code highlighting styles see https://github.com/richleland/pygments-css.
1.3.2 frog.rkt
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:
procedure
(init) → any
You can set various parameters provided by frog/params. To start, you might only need to set a few:
You may call functions provided by frog/enhance-body. You may also require and use functions provided by a third-party package.
procedure
(clean) → any
1.4 Creating blog posts
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.