wmkAdmin is a simple admin system for websites built with wmk. It requires wmk v1.3.0 or later.
-
Go to a wmk project directory
-
Clone this repository as a suitable subdirectory, e.g.
admin
. -
Create a file called
wmk_admin.yaml
in the project directory. It must contain anadmin_password
value. (The password should preferably be hashed with SHA-256 but can be written as plaintext if desired). -
Run
wmk admin .
(with wmk version 1.3.0 or greater). Alternatively, runpython admin/admin.py
after having loaded the wmk venv (or otherwise made all required python modules available). -
Access the admin system on
http://localhost:7077/_/admin/
(or with thehost
andport
configured in thewmk_admin.yaml
file) and log in.
The following settings are currently supported:
-
admin_password
: The SHA-256 sum of the password to the admin pages, in hexadecimal form. (There is no distinction between different users, so only a password is needed.) -
host
: The host or IP for the admin server. Default:localhost
. -
port
: The port for the admin server: Default: 7077. -
server
: The wsgi server to use. The default is wsgiref, but something else is recommended for any kind of heavy use. Good options arebjoern
,cheroot
andpaste
. -
deploy
: A shell command to run from the base directory of the project. The intention if for this to deploy any changes to the webserver where the published site is running, but obviously it can be used for other purposes as well. The command will be passed tosubprocess.run()
, so if it has arguments, it should be specified as a list rather than as a string. -
auto_metadata
: Which metadata fields to add automatically to the YAML frontmatter when saving files with a given extension. Example:auto_metadata: {'md': ['modified_date', 'created_date']}
. The fieldmodified_date
will be updated on each save, while other fields will only be added if missing. Supported fields:date
,created_date
,modified_date
. Take care that you only specify the extensions for file formats that support YAML frontmatter. -
preview_css
: CSS source (not URL) to use for the Quick preview function on the Edit page. -
img_to_editor_template
andattachment_to_editor_template
: Content for javascript string templates for adding images or links to attachments into markdown text when clicking on the appropriate links in the file list below the editor. The string{src}
indicates the placement of the image src or link href value. -
show_admin_overlay
: By default, the preview of the website includes a prominent overlay in the bottom-right corner of each page, with a link to the admin frontpage as well as to an editing form for the current page (if applicable). This can be turned off by settingshow_admin_overlay
tofalse
. The overlay can also be set to be visible only to a logged-in user by setting the value of this key to eitherlogged-in
oradmin
. -
recently_changed
: A dictionary with settings for the "Recently changed files" component, which is an optional part of the admin front page. The dictionary should have at least the keytype
(which must have a value of eithergit
orfind
). It can optionally have the keysdays_back
(default: 30),dirs
(default['content', 'data', 'templates', 'static']
),extensions
(default: all editatble extensions), andlimit
(default: 20).
All wmk_admin.yaml
settings except admin_password
are optional.
Potential features and improvements in the future:
- Improved Git interaction.
- Validate yaml and json before saving.
- Catch more errors and notify sensibly about them.
- View build logs.
- Manage
assets
directory in addition to the other three (?)
The license is MIT.