4 Commits

Author SHA1 Message Date
0379d38234 docs: new docs
All checks were successful
Lint / shellcheck (push) Successful in 22s
Release Standalone Builder / build (release) Successful in 33s
Release Standalone Builder / publish-aur (release) Successful in 34s
Release Standalone Builder / publish-homebrew (release) Successful in 6s
2026-03-25 10:42:24 +01:00
b22897135e feat: --generate-template 2026-03-25 10:20:19 +01:00
185cf769c3 fix: shellcheck style 2026-03-25 10:07:04 +01:00
b2acd26660 feat: custom directory indexes 2026-03-25 10:02:22 +01:00
10 changed files with 304 additions and 296 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,2 @@
out/ out/
kewt kewt
site.conf
template.html

222
kewt.sh
View File

@@ -13,6 +13,7 @@ Usage: $invoked_as [--from <src>] [--to <out>]
$invoked_as --new [title] $invoked_as --new [title]
$invoked_as --update [dir] $invoked_as --update [dir]
$invoked_as --post $invoked_as --post
$invoked_as --generate-template
$invoked_as --version $invoked_as --version
$invoked_as --help $invoked_as --help
@@ -21,6 +22,7 @@ Options:
--new [title] Create a new site directory (default: site) --new [title] Create a new site directory (default: site)
--update [dir] Update site.conf and template.html with latest defaults (defaults to current directory) --update [dir] Update site.conf and template.html with latest defaults (defaults to current directory)
--post Create a new empty post file in the configured posts_dir with current date and time as name --post Create a new empty post file in the configured posts_dir with current date and time as name
--generate-template [path] Generate a new template file at <path> (default: template.html)
--version Show version information. --version Show version information.
--from <src> Source directory (default: site) --from <src> Source directory (default: site)
--to <out> Output directory (default: out) --to <out> Output directory (default: out)
@@ -33,18 +35,7 @@ awk_dir="$script_dir/awk"
KEWT_TMPDIR=$(mktemp -d "/tmp/kewt_run.XXXXXX") KEWT_TMPDIR=$(mktemp -d "/tmp/kewt_run.XXXXXX")
trap 'rm -rf "$KEWT_TMPDIR"' EXIT HUP INT TERM trap 'rm -rf "$KEWT_TMPDIR"' EXIT HUP INT TERM
DEFAULT_CONF='title = "kewt"
create_new_site() {
new_title="$1"
new_dir="site"
[ -n "$new_title" ] && new_dir="$new_title"
[ -e "$new_dir" ] && die "Target '$new_dir' already exists."
mkdir -p "$new_dir"
cat > "$new_dir/site.conf" <<'EOF'
title = "kewt"
style = "kewt" style = "kewt"
dir_indexes = true dir_indexes = true
single_file_index = true single_file_index = true
@@ -68,11 +59,9 @@ base_url = ""
generate_feed = false generate_feed = false
feed_file = "rss.xml" feed_file = "rss.xml"
posts_dir = "" posts_dir = ""
custom_admonitions = "" custom_admonitions = ""'
EOF
cat > "$new_dir/template.html" <<'EOF' DEFAULT_TMPL='<!doctype html>
<!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
@@ -93,8 +82,29 @@ EOF
<article>{{CONTENT}}</article> <article>{{CONTENT}}</article>
<footer>{{FOOTER}}</footer> <footer>{{FOOTER}}</footer>
</body> </body>
</html> </html>'
EOF
generate_template() {
_gt_path="$1"
[ -e "$_gt_path" ] && die "File '$_gt_path' already exists."
_gt_dir=$(dirname "$_gt_path")
[ -d "$_gt_dir" ] || mkdir -p "$_gt_dir"
printf '%s\n' "$DEFAULT_TMPL" > "$_gt_path"
echo "Generated template at '$_gt_path'."
exit 0
}
create_new_site() {
new_title="$1"
new_dir="site"
[ -n "$new_title" ] && new_dir="$new_title"
[ -e "$new_dir" ] && die "Target '$new_dir' already exists."
mkdir -p "$new_dir"
printf '%s\n' "$DEFAULT_CONF" > "$new_dir/site.conf"
printf '%s\n' "$DEFAULT_TMPL" > "$new_dir/template.html"
printf "# _kewt_ website\n" > "$new_dir/index.md" printf "# _kewt_ website\n" > "$new_dir/index.md"
if [ -n "$new_title" ]; then if [ -n "$new_title" ]; then
@@ -147,33 +157,7 @@ update_site() {
# Generate default site.conf # Generate default site.conf
default_conf="$KEWT_TMPDIR/default_site.conf" default_conf="$KEWT_TMPDIR/default_site.conf"
cat > "$default_conf" <<'CONFEOF' printf '%s\n' "$DEFAULT_CONF" > "$default_conf"
title = "kewt"
style = "kewt"
dir_indexes = true
single_file_index = true
flatten = false
order = ""
home_name = "Home"
show_home_in_nav = true
nav_links = ""
nav_extra = ""
footer = "made with <a href=\"https://kewt.krzak.org\">kewt</a>"
logo = ""
display_logo = false
display_title = true
logo_as_favicon = true
favicon = ""
generate_page_title = true
error_page = "not_found.html"
versioning = false
enable_header_links = true
base_url = ""
generate_feed = false
feed_file = "rss.xml"
posts_dir = ""
custom_admonitions = ""
CONFEOF
# Update site.conf # Update site.conf
if [ ! -f "$target_conf" ]; then if [ ! -f "$target_conf" ]; then
@@ -203,30 +187,7 @@ CONFEOF
# Update template.html # Update template.html
if [ -f "$target_tmpl" ]; then if [ -f "$target_tmpl" ]; then
default_tmpl="$KEWT_TMPDIR/default_template.html" default_tmpl="$KEWT_TMPDIR/default_template.html"
cat > "$default_tmpl" <<'TMPLEOF' printf '%s\n' "$DEFAULT_TMPL" > "$default_tmpl"
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{TITLE}}</title>
<link rel="stylesheet" href="{{CSS}}" type="text/css" />
{{HEAD_EXTRA}}
</head>
<body>
<header>
<h1>{{HEADER_BRAND}}</h1>
</header>
<nav id="side-bar">{{NAV}}</nav>
<article>{{CONTENT}}</article>
<footer>{{FOOTER}}</footer>
</body>
</html>
TMPLEOF
if cmp -s "$default_tmpl" "$target_tmpl" 2>/dev/null; then if cmp -s "$default_tmpl" "$target_tmpl" 2>/dev/null; then
echo "template.html is already up to date." echo "template.html is already up to date."
else else
@@ -274,6 +235,14 @@ while [ $# -gt 0 ]; do
shift shift
fi fi
;; ;;
--generate-template)
generate_template_path="template.html"
if [ $# -gt 1 ] && [ "${2#-}" = "$2" ]; then
generate_template_path="$2"
shift
fi
generate_template "$generate_template_path"
;;
--update) --update)
update_dir="." update_dir="."
if [ $# -gt 1 ] && [ "${2#-}" = "$2" ]; then if [ $# -gt 1 ] && [ "${2#-}" = "$2" ]; then
@@ -610,30 +579,7 @@ template="$src/template.html"
[ -f "$template" ] || template="./template.html" [ -f "$template" ] || template="./template.html"
if [ ! -f "$template" ]; then if [ ! -f "$template" ]; then
template="$KEWT_TMPDIR/default_template.html" template="$KEWT_TMPDIR/default_template.html"
cat > "$template" <<'EOF' printf '%s\n' "$DEFAULT_TMPL" > "$template"
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{TITLE}}</title>
<link rel="stylesheet" href="{{CSS}}" type="text/css" />
{{HEAD_EXTRA}}
</head>
<body>
<header>
<h1>{{HEADER_BRAND}}</h1>
</header>
<nav id="side-bar">{{NAV}}</nav>
<article>{{CONTENT}}</article>
<footer>{{FOOTER}}</footer>
</body>
</html>
EOF
fi fi
[ -d "$out" ] && rm -rf "$out" [ -d "$out" ] && rm -rf "$out"
@@ -811,12 +757,21 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
[ "$dir_indexes" != "true" ] && continue [ "$dir_indexes" != "true" ] && continue
if [ ! -f "$dir/index.md" ]; then has_custom_index="false"
has_list="false"
if [ -f "$dir/index.md" ]; then
has_custom_index="true"
if grep -q '^[[:space:]]*{{LIST}}[[:space:]]*$' "$dir/index.md" 2>/dev/null; then
has_list="true"
fi
fi
if [ "$has_custom_index" = "false" ] || [ "$has_list" = "true" ]; then
is_posts_dir="false" is_posts_dir="false"
if [ -n "$posts_dir" ] && { [ "$rel_dir" = "$posts_dir" ] || [ "./$rel_dir" = "$posts_dir" ]; }; then if [ -n "$posts_dir" ] && { [ "$rel_dir" = "$posts_dir" ] || [ "./$rel_dir" = "$posts_dir" ]; }; then
is_posts_dir="true" is_posts_dir="true"
fi fi
if [ "$single_file_index" = "true" ] && [ "$is_posts_dir" = "false" ]; then if [ "$single_file_index" = "true" ] && [ "$is_posts_dir" = "false" ] && [ "$has_list" = "false" ]; then
md_count=$(find "$dir" ! -name "$(basename "$dir")" -prune -name "*.md" | wc -l) md_count=$(find "$dir" ! -name "$(basename "$dir")" -prune -name "*.md" | wc -l)
if [ "$md_count" -eq 1 ]; then if [ "$md_count" -eq 1 ]; then
md_file=$(find "$dir" ! -name "$(basename "$dir")" -prune -name "*.md") md_file=$(find "$dir" ! -name "$(basename "$dir")" -prune -name "*.md")
@@ -831,10 +786,16 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
fi fi
temp_index="$KEWT_TMPDIR/index.md" temp_index="$KEWT_TMPDIR/index.md"
temp_list="$KEWT_TMPDIR/list.md"
: > "$temp_list"
if [ "$has_custom_index" = "false" ]; then
display_dir="${rel_dir#.}" display_dir="${rel_dir#.}"
[ -z "$display_dir" ] && display_dir="/" [ -z "$display_dir" ] && display_dir="/"
echo "# Index of $display_dir" > "$temp_index" echo "# Index of $display_dir" > "$temp_index"
echo "" >> "$temp_index" echo "" >> "$temp_index"
fi
sort_args="" sort_args=""
# If this is the posts dir reverse # If this is the posts dir reverse
@@ -848,7 +809,7 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
template.html|site.conf|style.css|index.md) continue ;; template.html|site.conf|style.css|index.md) continue ;;
esac esac
if [ -d "$entry" ]; then if [ -d "$entry" ]; then
echo "- [${name}/](${name}/index.html)" >> "$temp_index" echo "- [${name}/](${name}/index.html)" >> "$temp_list"
elif [ "${entry%.md}" != "$entry" ]; then elif [ "${entry%.md}" != "$entry" ]; then
label="${name%.md}" label="${name%.md}"
@@ -916,18 +877,37 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
label="$p_date $p_time" label="$p_date $p_time"
fi fi
fi fi
echo "- [$label](${name%.md}.html)" >> "$temp_index" echo "- [$label](${name%.md}.html)" >> "$temp_list"
else else
echo "- [$name]($name)" >> "$temp_index" echo "- [$name]($name)" >> "$temp_list"
fi fi
done done
if [ "$has_custom_index" = "true" ]; then
awk '
/^[[:space:]]*\{\{LIST\}\}[[:space:]]*$/ {
while((getline line < "'"$temp_list"'") > 0) print line
close("'"$temp_list"'")
next
}
{ print }
' "$dir/index.md" > "$temp_index"
else
cat "$temp_list" >> "$temp_index"
fi
is_home="false"; [ "$dir" = "$src" ] && is_home="true" is_home="false"; [ "$dir" = "$src" ] && is_home="true"
target_url="/$rel_dir/index.html" target_url="/$rel_dir/index.html"
[ "$rel_dir" = "." ] && target_url="/index.html" [ "$rel_dir" = "." ] && target_url="/index.html"
if needs_rebuild "$dir" "$out_dir/index.html"; then
do_rebuild="false"
needs_rebuild "$dir" "$out_dir/index.html" && do_rebuild="true"
[ "$has_custom_index" = "true" ] && needs_rebuild "$dir/index.md" "$out_dir/index.html" && do_rebuild="true"
if [ "$do_rebuild" = "true" ]; then
render_markdown "$temp_index" "$is_home" "$target_url" > "$out_dir/index.html" render_markdown "$temp_index" "$is_home" "$target_url" > "$out_dir/index.html"
fi fi
rm "$temp_index" rm -f "$temp_index" "$temp_list"
fi fi
done done
@@ -945,6 +925,10 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type f -print" | sort | while
template.html|site.conf|style.css|styles.css) continue ;; template.html|site.conf|style.css|styles.css) continue ;;
esac esac
if [ "${file##*/}" = "index.md" ] && grep -q '^[[:space:]]*{{LIST}}[[:space:]]*$' "$file" 2>/dev/null; then
continue
fi
is_preserved=0 is_preserved=0
if [ -n "$(eval "find \"$file\" \( $PRESERVE_ARGS \) -print")" ]; then if [ -n "$(eval "find \"$file\" \( $PRESERVE_ARGS \) -print")" ]; then
is_preserved=1 is_preserved=1
@@ -1001,10 +985,12 @@ if [ -n "$base_url" ]; then
# Don't include 404 in the sitemap (duh) # Don't include 404 in the sitemap (duh)
[ "${rel_url#/}" = "$error_page" ] && continue [ "${rel_url#/}" = "$error_page" ] && continue
printf ' <url>\n' >> "$sitemap_file" {
printf ' <loc>%s%s</loc>\n' "$base_url" "$rel_url" >> "$sitemap_file" printf ' <url>\n'
printf ' <lastmod>%s</lastmod>\n' "$today" >> "$sitemap_file" printf ' <loc>%s%s</loc>\n' "$base_url" "$rel_url"
printf ' </url>\n' >> "$sitemap_file" printf ' <lastmod>%s</lastmod>\n' "$today"
printf ' </url>\n'
} >> "$sitemap_file"
done done
printf '</urlset>\n' >> "$sitemap_file" printf '</urlset>\n' >> "$sitemap_file"
@@ -1016,12 +1002,14 @@ if [ "$generate_feed" = "true" ] && [ -n "$base_url" ]; then
build_date=$(date -u '+%a, %d %b %Y %H:%M:%S +0000') build_date=$(date -u '+%a, %d %b %Y %H:%M:%S +0000')
printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$feed_path" printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$feed_path"
printf '<rss version="2.0">\n' >> "$feed_path" {
printf ' <channel>\n' >> "$feed_path" printf '<rss version="2.0">\n'
printf ' <title>%s</title>\n' "$title" >> "$feed_path" printf ' <channel>\n'
printf ' <link>%s</link>\n' "$base_url_feed" >> "$feed_path" printf ' <title>%s</title>\n' "$title"
printf ' <description>%s</description>\n' "$title" >> "$feed_path" printf ' <link>%s</link>\n' "$base_url_feed"
printf ' <lastBuildDate>%s</lastBuildDate>\n' "$build_date" >> "$feed_path" printf ' <description>%s</description>\n' "$title"
printf ' <lastBuildDate>%s</lastBuildDate>\n' "$build_date"
} >> "$feed_path"
find "$src" -type f -name '*.md' -path "*${posts_dir:-__no_posts__}*" -print | LC_ALL=C sort -r | while IFS= read -r post_file; do find "$src" -type f -name '*.md' -path "*${posts_dir:-__no_posts__}*" -print | LC_ALL=C sort -r | while IFS= read -r post_file; do
post_basename=$(basename "$post_file" .md) post_basename=$(basename "$post_file" .md)
@@ -1078,12 +1066,14 @@ if [ "$generate_feed" = "true" ] && [ -n "$base_url" ]; then
esac esac
pub_date="${pub_day} ${pub_mon} ${pub_year} ${post_time}:00 +0000" pub_date="${pub_day} ${pub_mon} ${pub_year} ${post_time}:00 +0000"
printf ' <item>\n' >> "$feed_path" {
printf ' <title>%s</title>\n' "$feed_post_title" >> "$feed_path" printf ' <item>\n'
printf ' <link>%s</link>\n' "$post_url" >> "$feed_path" printf ' <title>%s</title>\n' "$feed_post_title"
printf ' <guid>%s</guid>\n' "$post_url" >> "$feed_path" printf ' <link>%s</link>\n' "$post_url"
printf ' <pubDate>%s</pubDate>\n' "$pub_date" >> "$feed_path" printf ' <guid>%s</guid>\n' "$post_url"
printf ' </item>\n' >> "$feed_path" printf ' <pubDate>%s</pubDate>\n' "$pub_date"
printf ' </item>\n'
} >> "$feed_path"
done done
printf ' </channel>\n' >> "$feed_path" printf ' </channel>\n' >> "$feed_path"

View File

@@ -0,0 +1,37 @@
# Configuration
## Dot Files
- `.kewtignore` - files/directories to ignore completely. If the file is empty, the whole directory gets ignored.
- `.kewthide` - files/directories to hide from navigation but still process. Same empty-file rules as `.kewtignore`.
- `.kewtpreserve` - files/directories to copy as-is without converting markdown to HTML. Same empty-file rules again.
## Frontmatter
You can set metadata for a page using a `site.conf`-style frontmatter block at the very top of `.md` files:
```conf
---
title = "Custom Page Title"
date = "2026-03-23 11:32"
draft = false
---
```
- `title` - overrides the page title, post name in index links, and RSS `<title>`.
- `date` - overrides the post date and time. Supports `YYYY-MM-DD` and `YYYY-MM-DD HH:MM` (or `HH-MM`).
- `draft` - if `true`, the file is excluded from HTML generation.
## Directory Index Customisation
By default, directories without an `index.md` get an auto-generated index page listing their contents.
If you create your own `index.md` in a directory, you can still include the auto-generated file list by using the `{{LIST}}` placeholder:
```md
# Blog
This is my blog. The posts are below. The top-most one is the most recent.
{{LIST}}
```
The `{{LIST}}` tag will be replaced with the generated list of links to child pages and files, exactly as in case the custom index didn't exist.

21
site/Docs/embeds.md Normal file
View File

@@ -0,0 +1,21 @@
# Embeds
- `\![link]`:
- local image/audio/video files are embedded as media tags
- local text/code files are inlined directly
- global image/audio/video links are embedded as media tags
- other global links are embedded as `<iframe>`
- `\![alt](link)` works the same, with `alt` used for images
- `\!![link]` and `\!![alt](link)` force inline local file contents
If you want to **force** a file to be inlined, use `\!![]` instead of `\![]`
## Typed Embeds
Force specific output regardless of extension:
- `\!i[link]` or `\!i[alt](link)` - **I**mage
- `\!v[link]` - **V**ideo
- `\!a[link]` - **A**udio
- `\!f[link]` - I**f**rame
- `\!e[link]` - Inline/**e**mbed text/code file directly

3
site/Docs/index.md Normal file
View File

@@ -0,0 +1,3 @@
# Documentation
{{LIST}}

42
site/Docs/installation.md Normal file
View File

@@ -0,0 +1,42 @@
# Installation
## Standalone
```sh
curl -L -o kewt https://git.krzak.org/N0VA/kewt/releases/download/latest/kewt
chmod +x kewt
```
## From source
```sh
git clone https://git.krzak.org/N0VA/kewt.git
cd kewt
```
### Building
```sh
make
```
### Installing
```sh
sudo make install
```
## Package Managers
### AUR
- [kewt-bin](https://aur.archlinux.org/packages/kewt-bin) - prebuilt standalone binary from the latest release
- [kewt-git](https://aur.archlinux.org/packages/kewt-git) - built from the latest git source
### Homebrew
```sh
brew tap n0va-bot/tap
brew install kewt
```
### bpkg
```sh
bpkg install n0va-bot/kewt
```

71
site/Docs/usage.md Normal file
View File

@@ -0,0 +1,71 @@
# Usage
```sh
kewt --help
kewt --version
kewt --new [title]
kewt --post [title]
kewt --generate-template [path]
kewt --update [dir]
kewt --from <src> --to <out>
kewt [src] [out]
```
- `--new [title]` creates a new site directory with a default `site.conf`, `template.html`, and `index.md`.
- `--post [title]` creates a new markdown file in the configured `posts_dir` with the current date/time as the filename and default frontmatter.
- `--generate-template [path]` writes the default `template.html` to the given path (defaults to `template.html` in the current directory).
- `--update [dir]` adds any missing keys to `site.conf` and checks `template.html` against the latest default.
## site.conf
```conf
title = "kewt"
style = "kewt"
dir_indexes = true
single_file_index = true
flatten = false
order = ""
home_name = "Home"
show_home_in_nav = true
nav_links = ""
nav_extra = ""
footer = "made with <a href=\"https://kewt.krzak.org\">kewt</a>"
logo = ""
display_logo = false
display_title = true
logo_as_favicon = true
favicon = ""
generate_page_title = true
error_page = "not_found.html"
versioning = false
enable_header_links = true
base_url = ""
generate_feed = false
feed_file = "rss.xml"
posts_dir = ""
custom_admonitions = ""
```
- `title` - site title
- `style` - style file name from `./styles` (without `.css`)
- `dir_indexes` - generate directory index pages when missing `index.md`
- `single_file_index` - if a directory has one markdown file and no `index.md`, use that file as `index.html`
- `flatten` - flatten sidebar directory levels
- `order` - comma separated file/directory name list to order the sidebar (alphabetical by default)
- `home_name` - text for the home link in navigation (default: "Home")
- `show_home_in_nav` - show home link in navigation (default: true)
- `nav_links` - comma separated extra nav links, as bare URLs or Markdown links like `[Label](https://example.com)`
- `nav_extra` - raw HTML appended inside the `<nav>` after the generated link list
- `footer` - footer html/text shown at the bottom of pages
- `logo` - logo image path (used in header if enabled)
- `display_logo` - show logo in header
- `display_title` - show title text in header
- `logo_as_favicon` - use `logo` as favicon
- `favicon` - explicit favicon path (used when `logo_as_favicon` is false or no logo is set)
- `generate_page_title` - automatically generate title text from the first markdown heading or filename (default: true)
- `error_page` - filename for the generated 404 error page (default: "not_found.html", empty to disable)
- `versioning` - append a version query parameter (`?v=timestamp`) to css asset urls to bypass cache (default: false)
- `base_url` - absolute URL of the site, used for sitemap and RSS feed generation
- `generate_feed` - enable RSS feed generation (requires `base_url`)
- `feed_file` - filename for the generated RSS feed (default: "rss.xml")
- `posts_dir` - directory name containing posts (e.g., "posts"). Enables reverse-chronological sorting, title headings in indexes, and automatic backlinks.
- `enable_header_links` - turns markdown section headings into clickable anchor links (default: true)
- `custom_admonitions` - comma separated list of custom admonitions

5
site/depths/index.md Normal file
View File

@@ -0,0 +1,5 @@
# Depths
This is a custom index for a directory
{{LIST}}

View File

@@ -30,169 +30,7 @@ It's meant to be a static site generator, like _[kew](https://github.com/uint23/
- Code block classes for use with external libraries like highlight.js or prism.js (both tested) - Code block classes for use with external libraries like highlight.js or prism.js (both tested)
- Clickable markdown header anchors - Clickable markdown header anchors
- Mobile responsive layout - Mobile responsive layout
- Customisable directory index pages with `{{LIST}}`
If you want to **force** a file to be inlined, use `\!![]` instead of `\![]`
***
## Installation
### Standalone
```sh
curl -L -o kewt https://git.krzak.org/N0VA/kewt/releases/download/latest/kewt
chmod +x kewt
```
### From source
```sh
git clone https://git.krzak.org/N0VA/kewt.git
cd kewt
```
#### Building
```sh
make
```
#### Installing
```sh
sudo make install
```
### Package Managers
#### AUR
- [kewt-bin](https://aur.archlinux.org/packages/kewt-bin) — prebuilt standalone binary from the latest release
- [kewt-git](https://aur.archlinux.org/packages/kewt-git) — built from the latest git source
#### Homebrew
```sh
brew tap n0va-bot/tap
brew install kewt
```
#### bpkg
```sh
bpkg install n0va-bot/kewt
```
***
## Usage
```sh
./kewt.sh --help
./kewt.sh --version
./kewt.sh --new [title]
./kewt.sh --post
./kewt.sh --from <src> --to <out>
./kewt.sh [src] [out]
```
`--new [title]` creates a new site directory with a copied `site.conf` and a default `index.md`.
`--post [title]` creates a new markdown file in the configured `posts_dir` with the current date/time as the name and creates the default frontmatter.
### site.conf
```conf
title = "kewt"
style = "kewt"
dir_indexes = true
single_file_index = true
flatten = false
order = ""
home_name = "Home"
show_home_in_nav = true
nav_links = ""
nav_extra = ""
footer = "made with <a href=\"https://kewt.krzak.org\">kewt</a>"
logo = ""
display_logo = false
display_title = true
logo_as_favicon = true
favicon = ""
generate_page_title = true
error_page = "not_found.html"
versioning = false
base_url = ""
generate_feed = false
feed_file = "rss.xml"
posts_dir = ""
enable_header_links = true
custom_admonitions = ""
```
- `title` site title
- `style` style file name from `./styles` (without `.css`)
- `dir_indexes` generate directory index pages when missing `index.md`
- `single_file_index` if a directory has one markdown file and no `index.md`, use that file as `index.html`
- `flatten` flatten sidebar directory levels
- `order` comma separated file/directory name list to order the sidebar (alphabetical by default)
- `home_name` text for the home link in navigation (default: "Home")
- `show_home_in_nav` show home link in navigation (default: true)
- `nav_links` comma separated extra nav links, as bare URLs or Markdown links like `[Label](https://example.com)`
- `nav_extra` raw HTML appended inside the `<nav>` after the generated link list
- `footer` footer html/text shown at the bottom of pages
- `logo` logo image path (used in header if enabled)
- `display_logo` show logo in header
- `display_title` show title text in header
- `logo_as_favicon` use `logo` as favicon
- `favicon` explicit favicon path (used when `logo_as_favicon` is false or no logo is set)
- `generate_page_title` automatically generate title text from the first markdown heading or filename (default: true)
- `error_page` filename for the generated 404 error page (default: "not_found.html", empty to disable)
- `versioning` append a version query parameter (`?v=timestamp`) to css asset urls to bypass cache (default: false)
- `base_url` absolute URL of the site, used for sitemap and RSS feed generation
- `generate_feed` enable RSS feed generation (requires `base_url`)
- `feed_file` filename for the generated RSS feed (default: "rss.xml")
- `posts_dir` directory name containing posts (e.g., "posts"). Enables reverse-chronological sorting, title headings in indexes, and automatic backlinks.
- `enable_header_links` turns markdown section headings into clickable anchor links (default: true)
- `custom_admonitions` comma separated list of custom admonitions
### Ignores
- `.kewtignore`: Files/directories to ignore. If empty, the whole directory gets ignored
- `.kewthide`: Files/directories to hide from navigation but still process. Same empty rules as with ignore
- `.kewtpreserve`: Files/directories to copy but not convert markdown to html. Same empty rules again
### Embeds
- `\![link]`:
- local image/audio/video files are embedded as media tags
- local text/code files are inlined directly
- global image/audio/video links are embedded as media tags
- other global links are embedded as `<iframe>`
- `\![alt](link)` works the same, with `alt` used for images
- `\!![]` and `\!![alt](link)` force inline local file contents
- **Typed Embeds**: Force specific output regardless of extension:
- `\!i[link]` or `\!i[alt](link)`: **I**mage
- `\!v[link]`: **V**ideo
- `\!a[link]`: **A**udio
- `\!f[link]`: I**f**rame
- `\!e[link]`: Inline/**e**mbed text/code file directly
### Frontmatter
You can set metadata for a page using a `site.conf`-style frontmatter block at the very top of `.md` files:
```conf
---
title = "Custom Page Title"
date = "2026-03-23 11:32"
draft = false
---
```
- `title`: Overrides the page title, post name in index links, and RSS `<title>`.
- `date`: Overrides the post date and time. Supports `YYYY-MM-DD` and `YYYY-MM-DD HH:MM` (or `HH-MM`).
- `draft`: If `true`, the file is excluded from HTML generation
*** ***

View File

@@ -9,7 +9,7 @@ display_logo = false
display_title = true display_title = true
logo_as_favicon = false logo_as_favicon = false
favicon = "favicon.ico" favicon = "favicon.ico"
order = "" order = "Home, Docs, depths, Heaven"
home_name = "Home" home_name = "Home"
show_home_in_nav = true show_home_in_nav = true
nav_links = "" nav_links = ""
@@ -20,3 +20,6 @@ versioning = true
enable_header_links = true enable_header_links = true
base_url = "https://kewt.krzak.org" base_url = "https://kewt.krzak.org"
custom_admonitions = "" custom_admonitions = ""
generate_feed = false
feed_file = "rss.xml"
posts_dir = ""