1
0
Fork
You've already forked lichen
0
forked from stringbone/lichen
sensorstation's Lichen, graciously handed over by winduptoy at https://www.sensorstation.co/
  • JavaScript 55.3%
  • Forth 18.2%
  • Perl 13.6%
  • CSS 5.9%
  • HTML 5%
  • Other 2%
Find a file
stringbone 1e37da36ca #43 Add caveat in docs for NFS, prettier formatting in README ( #44 )
Co-authored-by: Milo Fultz <milopfultz@gmail.com>
Reviewed-on: stringbone/lichen#44 
2024年10月23日 23:15:38 +00:00
cgi-bin #38 Add skip link to file browser navigation, handle focus on panel change ( #39 ) 2024年02月26日 16:46:59 +00:00
spec Make all decorative emojis presentational ( #35 ) 2024年02月19日 23:25:29 +00:00
template Fix small bits in template ( #37 ) 2024年02月21日 02:31:49 +00:00
unmaintained #9 Remove sample folder, update all root files to match ( #28 ) 2024年01月20日 18:49:56 +00:00
.eslintrc.js #2 Create tests for all existing utilities ( #34 ) 2024年02月19日 22:29:00 +00:00
.gitignore #2 Use query strings over direct paths for all file server queries ( #31 ) 2024年01月26日 23:10:40 +00:00
.prettierrc #7 Add prettier to repo ( #10 ) 2024年01月16日 03:06:24 +00:00
build.sh Core build functionality complete. 2022年11月26日 22:28:43 -05:00
CONTRIBUTING #7 Add ESLint to repo and make changes found through it's addition ( #19 ) 2024年01月16日 05:08:34 +00:00
editor.png Added site content. 2022年12月01日 22:15:11 -05:00
files.png Multiline blockquote is configurable. 2022年12月06日 15:02:40 -05:00
index.gmi Fix small bits in template ( #37 ) 2024年02月21日 02:31:49 +00:00
LICENSE #9 Remove sample folder, update all root files to match ( #28 ) 2024年01月20日 18:49:56 +00:00
lichen.png Added site content. 2022年12月01日 22:15:11 -05:00
package-lock.json #2 Create tests for all existing utilities ( #34 ) 2024年02月19日 22:29:00 +00:00
package.json #2 Create tests for all existing utilities ( #34 ) 2024年02月19日 22:29:00 +00:00
README.md #43 Add caveat in docs for NFS, prettier formatting in README ( #44 ) 2024年10月23日 23:15:38 +00:00
TODO.txt #38 Add skip link to file browser navigation, handle focus on panel change ( #39 ) 2024年02月26日 16:46:59 +00:00

Lichen

Lichen is the simplest possible CMS for the web that is friendly enough for non-technical users. Comprised of just a few Forth CGI scripts, it is extremely lightweight. This site is built in Lichen. It can also be used as a static site generator.

A screenshot of Lichen showing the editor on the left and the rendered HTML on the right.

Rationale

When looking for a way for non-programmers to edit their website, many people reach for WordPress or something similar, which consumes many times more computing resources than the moon lander. Plugins, security updates, and a SQL database are a lot of overhead for sharing text and images online. On the other hand, writing HTML and CSS by hand is so complex these days that the layperson has no time or interest to learn to do it, not to mention understanding what a SSH key is and how to edit the site over SFTP. Installing dependencies, compiling a static site, and managing a Git repo involves similar complexity.

Lichen is designed to hit the sweet spot between WordPress and manually editing HTML. A technically-inclined person can easily set up many Lichen sites for friends with minimal effort without having to worry about the technical burden of maintaining a database-driven CMS.

Content is stored as Gemtext, the lightweight markup language of the Gemini protocol. Why Gemtext?

  • It's easier to learn and more forgiving than Markdown.
  • You don't need a heavy JavaScript-enabled rich-text WYSIWYG editor.
  • It's simple to parse and render.
  • Constraints breed creativity.
  • Content authored in Gemtext is automatically Gemini-friendly; a correctly-configured server can serve both protocols from a single source of content.

Learn more about Gemtext.

The content is the most important part of a site. When your content is constrained to a single column of text with hand-edited links, it is more intimate and intentional. The writer is required to make the content good enough to be worth reading without relying on the crutch of complex layouts and fancy web widgets. The reader is no longer burdened with heavy web pages and distracting/buggy UI. All of this adds up to an extremely lightweight environment: low cost, low resources, low cognitive overhead, low environmental impact.

Usage

A screenshot of Lichen's editor, with three buttons and their associated labels: "Files" labeled with "File manager"; "Help" labeled with "Gemtext cheatsheet"; and "Save" labeled with "Commit changes".

Navigate to /cgi-bin/edit.cgi to edit your homepage. Changes you make to the raw Gemtext on the left are reflected in the live preview on the right.

Links to files with a .gmi extension will automatically be translated to .html. Links to files with common image, audio, and video extensions are automatically rendered to their respective HTML elements.

Click the green "Save" button at the bottom to save your content and render a fresh HTML file.

A screenshot of the file manager, showing a hierarchical list of files and folders. One folder has associated buttons to add a file, add a folder, upload a file, or delete the folder. There is a button at the bottom that returns to the editor view.

The file manager allows you to create new pages and folders, and upload files like images and videos.

Click on a Gemtext file (.gmi) to edit it.

Hover a file and click the 🔗 button to return to the editor and insert a link to that file. It will be inserted at the current cursor position.

Utils

If you need to rebuild all pages of your site, run the ./build.sh script in the root directory.

System Requirements

  • A POSIX-compatible environment
  • A CGI-capable web server
  • Gforth v0.7.3+

NearlyFreeSpeech is an excellent, inexpensive web host that works well with Lichen.

NearlyFreeSpeech

Installation

  • Download Lichen and extract the contents to your web server's public folder
  • Password-protect the /cgi-bin directory (more below)
  • Verify that all .cgi files in the cgi-bin folder have execute permissions enabled
  • Ensure that the public files can be written and modified by your web server; this may require changing file or directory permissions. For example, run the following command on NearlyFreeSpeech in the public directory:
# Change the folder to be owned by the "web" group
chgrp -R web /home/public
# Allow group writes on all existing "gmi" files
chmod g+w /home/public/*.gmi

If your Apache server is not already configured to run CGI scripts, add this configuration and adjust the paths as necessary:

ScriptAlias /cgi-bin/ /var/www/html/cgi-bin/
<Directory "/var/www/html/cgi-bin">
</Directory>

⚠️ Important ⚠️

Create an htpasswd file and update the path in the cgi-bin/.htaccess file. This password-protects the interface to edit your site.

htpasswd documentation

If you're not using Apache, follow your web server's instructions.

A caveat, for those using NearlyFreeSpeech (h/t @cena, thank you!):

The path to .htpasswd defined in ../cgi-bin/.htaccess must contain the Apache Site Root, as defined in members.nfs.net/username/sites/mysite. In other words, it must be something like /NFSdomain/siteshortname/protected/.htpasswd, NOT /home/protected/.htpasswd. (Assuming your .htpasswd is in /home/protected.)

Customize

A complete page is comprised of Gemtext rendered to HTML and sandwiched between the contents of template/_header.html and template/_footer.html. Edit these template files to customize the HTML that is common between all pages. Remember to rebuild all pages with the ./build.sh script after editing any template files (HTML is only re-generated when the "Save" button is clicked from the web interface).

Local Development

Most CGI-compatible web servers should work. Busybox provides a lightweight one.

$ busybox httpd -p 8000 -f

The Forth code expects the current working directory to be it's own directory (cgi-bin), not the web root. Python's http.server does not work because it doesn't set the CWD to /cgi-bin when invoking a CGI script.

Changelog

This changelog will include all minor and major releases. You can find more about the patch releases via git show vX.X.X or in the "Tags" at the top of this page.

2.0 (2022年12月22日)

  • Rewrote from scratch in Forth
  • Requires Gforth v0.7.3+ (PHP no longer required)
  • Requires server with CGI support for editor
  • Simplified server requirements: htaccess rewrites no longer used
  • Includes static site generation script (editor component not required)
  • Improved efficiency: changes are rendered to static HTML when saved rather than when the page is accessed
  • Added warning when navigating away from editor source
  • JPEG and PNG images are optionally resized in the browser before upload (no server component required)

Previous Version

You can find the previous version that ran using PHP in the unmaintained folder.