A minimalist blog built with groff on OpenBSD, designed for simplicity and lightweight performance. This blog uses groff to generate HTML content from .ms files, styled with a clean, retro-inspired CSS theme. It features a fixed sidebar with links and a responsive layout.
- Lightweight: Built with groff and minimal CSS/JS, ensuring fast load times.
- Static Site: No server-side processing; all pages are pre-generated HTML.
- Responsive Design: Adapts to mobile and desktop screens.
- Customizable: Easily configure the blog name, subtitle, colors, and sidebar links.
- SEO-Friendly: Includes meta tags for better search engine visibility.
- Source Code View: Each post and static page includes a "View Source" link to view the formatted
.mssource as HTML.
To set up and run this blog, you'll need:
- OpenBSD (or another UNIX-like system with groff installed).
- groff: For processing
.msfiles into HTML. Install withpkg_add groffon OpenBSD. - ksh: The Korn shell, used for the build script. Typically pre-installed on OpenBSD.
- A web server (e.g.,
httpdon OpenBSD) to serve the generated HTML files. - A text editor to write
.msfiles (e.g.,vi,nano).
-
Clone the Repository (if applicable):
git clone <repository-url> cd my-groff-blog -
Directory Structure:
Ensure your directory looks like this:
. ├── blog.conf # Configuration file (optional) ├── newpost.ksh # Script to create new posts ├── publish.ksh # Build script to generate the site ├── index.ms # Index page description (groff .ms file) ├── pages/ # Static pages (e.g., bio.ms, contact.ms) │ ├── bio.ms │ └── contact.ms ├── posts/ # Blog posts (groff .ms files) │ ├── post1.ms │ └── post2.ms ├── sidebar.links # Sidebar links configuration (optional) ├── static/ # Static assets (CSS, fonts, images) │ ├── css/ │ │ └── base.css │ ├── fonts/ │ │ ├── JetBrainsMono-Regular.woff2 │ │ └── fontawesome-webfont.woff2 │ └── images/ │ └── profile.jpg ├── templates/ # HTML templates │ ├── index.html.tmpl │ ├── post.html.tmpl │ └── static.html.tmpl └── public/ # Generated output directory (created by build script) ├── YYYY/MM/DD/ # Blog posts (e.g., 2025/03/28/post1.html) ├── css/ # CSS files ├── fonts/ # Font files ├── images/ # Image files └── bio.html # Static pages -
Install Dependencies:
On OpenBSD, ensure groff is installed:
doas pkg_add groff -
Configure the Blog (Optional):
-
Edit
blog.confto customize the blog name, colors, and subtitle:BLOG_NAME="My Groff Blog" THEME_FONT="JetBrains Mono" LIGHT_BG="#ffffff" LIGHT_FG="#000000" LIGHT_LINK="#1a73e8" DARK_BG="#1e1e1e" DARK_FG="#d4d4d4" DARK_LINK="#8ab4f8" SITE_SUBTITLE="A minimalist blog built with groff on OpenBSD" -
Edit
sidebar.linksto customize the sidebar links (format:type|url|label|icon):link|https://x.com/yourusername|X: @yourusername|fa-twitter link|https://yourwebsite.com|My Website|fa-globe link|https://x.com/anotheruser|X: @anotheruser|fa-twitter
-
-
Add a Profile Picture:
Place a
profile.jpgfile instatic/images/. This will be displayed in the sidebar. -
Add a Favicon (Optional):
Place a
favicon.icofile instatic/. This will be used as the browser tab icon. -
Write Content:
-
Add blog posts in the
posts/directory as.msfiles (e.g.,posts/post1.ms):.TL A Minimalist Blog Post .AU Alex Smith .DA March 26, 2025 .PP Welcome to my first post, written in groff on OpenBSD. -
Edit
index.msfor the index page description:.TL Welcome to My Groff Blog .PP This is a minimalist blog built with groff on OpenBSD. I share my thoughts on minimalist coding, UNIX philosophy, and the power of groff. Explore my posts, bio, and contact information below. -
Add static pages (e.g., Bio, Contact) in the
pages/directory as.msfiles.
-
-
Build the Site:
Run the build script to generate the HTML files:
./publish.kshThis will create the
public/directory with all generated HTML, CSS, and assets. -
Serve the Site:
-
Use OpenBSD's
httpdto serve thepublic/directory:doas cp -r public/* /var/www/htdocs/ doas rcctl enable httpd doas rcctl start httpd -
Alternatively, use any web server (e.g., Nginx, Apache) or a local development server:
cd public python3 -m http.server 8000 -
Open http://localhost:8000 (or your server's URL) in a browser to view the blog.
-
- Blog Name and Subtitle: Edit
blog.confto changeBLOG_NAMEandSITE_SUBTITLE. - Colors: Modify
blog.confto adjustLIGHT_BG,LIGHT_FG,LIGHT_LINK,DARK_BG,DARK_FG, andDARK_LINK. - Sidebar Links: Edit
sidebar.linksto add or remove links. - Profile Picture: Replace
static/images/profile.jpgwith your own image. - Favicon: Add a
favicon.icotostatic/.
blog.conf: Configuration file for blog settings (optional).newpost.ksh: Script to create new blog posts interactively.publish.ksh: Script to generate the static site.index.ms: Groff file for the index page description.pages/: Directory for static pages (e.g.,bio.ms,contact.ms).posts/: Directory for blog posts (e.g.,post1.ms).sidebar.links: Configuration file for sidebar links (optional).static/: Directory for static assets (CSS, fonts, images).templates/: Directory for HTML templates (index.html.tmpl,post.html.tmpl,static.html.tmpl).public/: Output directory for the generated site, with posts inYYYY/MM/DD/subdirectories.
-
Content Creation:
- Blog posts and static pages are written in groff
.msformat (e.g.,posts/post1.ms,pages/bio.ms). - The index page description is written in
index.ms.
- Blog posts and static pages are written in groff
-
Build Process:
- The
publish.kshscript:- Processes
.msfiles with groff to generate HTML. - Sorts posts by date (newest first) and places them in
public/YYYY/MM/DD/. - Generates the sidebar with links from
sidebar.linksand static pages. - Applies HTML templates (
index.html.tmpl,post.html.tmpl,static.html.tmpl) to create the final pages. - Copies static assets (CSS, fonts, images) to categorized subdirectories in
public/.
- Processes
- The
-
Styling:
base.css: Main stylesheet for layout and styling.vars.css: Defines color variables (generated fromblog.conf).
-
Output:
- The
public/directory contains the static site, ready to be served by a web server.
- The
-
Create a New Post:
Use the
newpost.kshscript to generate a new.msfile inposts/:./newpost.ksh "My New Post"This creates
posts/my-new-post.mswith a template (title, author from GECOS, current date). Optionally, it prompts to open it in$EDITORorvi. -
Run the Build Script:
./publish.kshThe new post will appear in
public/YYYY/MM/DD/(e.g.,public/2025/03/27/my-new-post.html) and on the index page, sorted by date.
-
Create a New Static Page:
Create a new
.msfile in thepages/directory (e.g.,pages/about.ms):.TL About Me .PP I'm Alex, a minimalist coder who loves OpenBSD and groff. -
Run the Build Script:
./publish.kshThe new page will be generated (e.g.,
public/about.html) with a "View Source" link topublic/about_source.htmland added to the sidebar.
- Missing Bullets: The sidebar uses
<div>and<span>elements instead of<ul>to avoid bullet rendering issues. - Theme Not Applying: Ensure
amber.cssandgreen.cssare instatic/css/, and check the JavaScript console for errors. - Build Errors: Ensure groff is installed and all required files (
index.ms,templates/,static/) are present. - 404 Errors: Verify that all static assets (e.g.,
profile.jpg,favicon.ico) are in thestatic/directory.
This project is licensed under the MIT License. Feel free to use, modify, and distribute it as you see fit.
- Built with groff and OpenBSD.
- Fonts: JetBrains Mono and FontAwesome.
- Inspired by minimalist, UNIX-friendly design principles.