Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0379d38234 | |||
| b22897135e | |||
| 185cf769c3 | |||
| b2acd26660 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,2 @@
|
||||
out/
|
||||
kewt
|
||||
site.conf
|
||||
template.html
|
||||
|
||||
244
kewt.sh
244
kewt.sh
@@ -13,17 +13,19 @@ Usage: $invoked_as [--from <src>] [--to <out>]
|
||||
$invoked_as --new [title]
|
||||
$invoked_as --update [dir]
|
||||
$invoked_as --post
|
||||
$invoked_as --generate-template
|
||||
$invoked_as --version
|
||||
$invoked_as --help
|
||||
|
||||
Options:
|
||||
--help Show this help message.
|
||||
--new [title] Create a new site directory (default: site)
|
||||
--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
|
||||
--version Show version information.
|
||||
--from <src> Source directory (default: site)
|
||||
--to <out> Output directory (default: out)
|
||||
--help Show this help message.
|
||||
--new [title] Create a new site directory (default: site)
|
||||
--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
|
||||
--generate-template [path] Generate a new template file at <path> (default: template.html)
|
||||
--version Show version information.
|
||||
--from <src> Source directory (default: site)
|
||||
--to <out> Output directory (default: out)
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -33,18 +35,7 @@ awk_dir="$script_dir/awk"
|
||||
KEWT_TMPDIR=$(mktemp -d "/tmp/kewt_run.XXXXXX")
|
||||
trap 'rm -rf "$KEWT_TMPDIR"' EXIT HUP INT TERM
|
||||
|
||||
|
||||
|
||||
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"
|
||||
DEFAULT_CONF='title = "kewt"
|
||||
style = "kewt"
|
||||
dir_indexes = true
|
||||
single_file_index = true
|
||||
@@ -68,11 +59,9 @@ base_url = ""
|
||||
generate_feed = false
|
||||
feed_file = "rss.xml"
|
||||
posts_dir = ""
|
||||
custom_admonitions = ""
|
||||
EOF
|
||||
custom_admonitions = ""'
|
||||
|
||||
cat > "$new_dir/template.html" <<'EOF'
|
||||
<!doctype html>
|
||||
DEFAULT_TMPL='<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -93,8 +82,29 @@ EOF
|
||||
<article>{{CONTENT}}</article>
|
||||
<footer>{{FOOTER}}</footer>
|
||||
</body>
|
||||
</html>
|
||||
EOF
|
||||
</html>'
|
||||
|
||||
|
||||
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"
|
||||
|
||||
if [ -n "$new_title" ]; then
|
||||
@@ -147,33 +157,7 @@ update_site() {
|
||||
|
||||
# Generate default site.conf
|
||||
default_conf="$KEWT_TMPDIR/default_site.conf"
|
||||
cat > "$default_conf" <<'CONFEOF'
|
||||
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
|
||||
printf '%s\n' "$DEFAULT_CONF" > "$default_conf"
|
||||
|
||||
# Update site.conf
|
||||
if [ ! -f "$target_conf" ]; then
|
||||
@@ -203,30 +187,7 @@ CONFEOF
|
||||
# Update template.html
|
||||
if [ -f "$target_tmpl" ]; then
|
||||
default_tmpl="$KEWT_TMPDIR/default_template.html"
|
||||
cat > "$default_tmpl" <<'TMPLEOF'
|
||||
<!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
|
||||
printf '%s\n' "$DEFAULT_TMPL" > "$default_tmpl"
|
||||
if cmp -s "$default_tmpl" "$target_tmpl" 2>/dev/null; then
|
||||
echo "template.html is already up to date."
|
||||
else
|
||||
@@ -274,6 +235,14 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
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_dir="."
|
||||
if [ $# -gt 1 ] && [ "${2#-}" = "$2" ]; then
|
||||
@@ -610,30 +579,7 @@ template="$src/template.html"
|
||||
[ -f "$template" ] || template="./template.html"
|
||||
if [ ! -f "$template" ]; then
|
||||
template="$KEWT_TMPDIR/default_template.html"
|
||||
cat > "$template" <<'EOF'
|
||||
<!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
|
||||
printf '%s\n' "$DEFAULT_TMPL" > "$template"
|
||||
fi
|
||||
|
||||
[ -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
|
||||
|
||||
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"
|
||||
if [ -n "$posts_dir" ] && { [ "$rel_dir" = "$posts_dir" ] || [ "./$rel_dir" = "$posts_dir" ]; }; then
|
||||
is_posts_dir="true"
|
||||
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)
|
||||
if [ "$md_count" -eq 1 ]; then
|
||||
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
|
||||
|
||||
temp_index="$KEWT_TMPDIR/index.md"
|
||||
display_dir="${rel_dir#.}"
|
||||
[ -z "$display_dir" ] && display_dir="/"
|
||||
echo "# Index of $display_dir" > "$temp_index"
|
||||
echo "" >> "$temp_index"
|
||||
temp_list="$KEWT_TMPDIR/list.md"
|
||||
: > "$temp_list"
|
||||
|
||||
if [ "$has_custom_index" = "false" ]; then
|
||||
display_dir="${rel_dir#.}"
|
||||
[ -z "$display_dir" ] && display_dir="/"
|
||||
echo "# Index of $display_dir" > "$temp_index"
|
||||
echo "" >> "$temp_index"
|
||||
fi
|
||||
|
||||
|
||||
sort_args=""
|
||||
# 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 ;;
|
||||
esac
|
||||
if [ -d "$entry" ]; then
|
||||
echo "- [${name}/](${name}/index.html)" >> "$temp_index"
|
||||
echo "- [${name}/](${name}/index.html)" >> "$temp_list"
|
||||
elif [ "${entry%.md}" != "$entry" ]; then
|
||||
label="${name%.md}"
|
||||
|
||||
@@ -916,18 +877,37 @@ eval "find \"$src\" \( $IGNORE_ARGS \) -prune -o -type d -print" | sort | while
|
||||
label="$p_date $p_time"
|
||||
fi
|
||||
fi
|
||||
echo "- [$label](${name%.md}.html)" >> "$temp_index"
|
||||
echo "- [$label](${name%.md}.html)" >> "$temp_list"
|
||||
else
|
||||
echo "- [$name]($name)" >> "$temp_index"
|
||||
echo "- [$name]($name)" >> "$temp_list"
|
||||
fi
|
||||
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"
|
||||
target_url="/$rel_dir/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"
|
||||
fi
|
||||
rm "$temp_index"
|
||||
rm -f "$temp_index" "$temp_list"
|
||||
fi
|
||||
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 ;;
|
||||
esac
|
||||
|
||||
if [ "${file##*/}" = "index.md" ] && grep -q '^[[:space:]]*{{LIST}}[[:space:]]*$' "$file" 2>/dev/null; then
|
||||
continue
|
||||
fi
|
||||
|
||||
is_preserved=0
|
||||
if [ -n "$(eval "find \"$file\" \( $PRESERVE_ARGS \) -print")" ]; then
|
||||
is_preserved=1
|
||||
@@ -1001,10 +985,12 @@ if [ -n "$base_url" ]; then
|
||||
# Don't include 404 in the sitemap (duh)
|
||||
[ "${rel_url#/}" = "$error_page" ] && continue
|
||||
|
||||
printf ' <url>\n' >> "$sitemap_file"
|
||||
printf ' <loc>%s%s</loc>\n' "$base_url" "$rel_url" >> "$sitemap_file"
|
||||
printf ' <lastmod>%s</lastmod>\n' "$today" >> "$sitemap_file"
|
||||
printf ' </url>\n' >> "$sitemap_file"
|
||||
{
|
||||
printf ' <url>\n'
|
||||
printf ' <loc>%s%s</loc>\n' "$base_url" "$rel_url"
|
||||
printf ' <lastmod>%s</lastmod>\n' "$today"
|
||||
printf ' </url>\n'
|
||||
} >> "$sitemap_file"
|
||||
done
|
||||
|
||||
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')
|
||||
|
||||
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 ' <title>%s</title>\n' "$title" >> "$feed_path"
|
||||
printf ' <link>%s</link>\n' "$base_url_feed" >> "$feed_path"
|
||||
printf ' <description>%s</description>\n' "$title" >> "$feed_path"
|
||||
printf ' <lastBuildDate>%s</lastBuildDate>\n' "$build_date" >> "$feed_path"
|
||||
{
|
||||
printf '<rss version="2.0">\n'
|
||||
printf ' <channel>\n'
|
||||
printf ' <title>%s</title>\n' "$title"
|
||||
printf ' <link>%s</link>\n' "$base_url_feed"
|
||||
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
|
||||
post_basename=$(basename "$post_file" .md)
|
||||
@@ -1078,12 +1066,14 @@ if [ "$generate_feed" = "true" ] && [ -n "$base_url" ]; then
|
||||
esac
|
||||
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 ' <link>%s</link>\n' "$post_url" >> "$feed_path"
|
||||
printf ' <guid>%s</guid>\n' "$post_url" >> "$feed_path"
|
||||
printf ' <pubDate>%s</pubDate>\n' "$pub_date" >> "$feed_path"
|
||||
printf ' </item>\n' >> "$feed_path"
|
||||
{
|
||||
printf ' <item>\n'
|
||||
printf ' <title>%s</title>\n' "$feed_post_title"
|
||||
printf ' <link>%s</link>\n' "$post_url"
|
||||
printf ' <guid>%s</guid>\n' "$post_url"
|
||||
printf ' <pubDate>%s</pubDate>\n' "$pub_date"
|
||||
printf ' </item>\n'
|
||||
} >> "$feed_path"
|
||||
done
|
||||
|
||||
printf ' </channel>\n' >> "$feed_path"
|
||||
|
||||
37
site/Docs/configuration.md
Normal file
37
site/Docs/configuration.md
Normal 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
21
site/Docs/embeds.md
Normal 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>`
|
||||
- `\` works the same, with `alt` used for images
|
||||
- `\!![link]` and `\!` 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
3
site/Docs/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Documentation
|
||||
|
||||
{{LIST}}
|
||||
42
site/Docs/installation.md
Normal file
42
site/Docs/installation.md
Normal 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
71
site/Docs/usage.md
Normal 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
5
site/depths/index.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Depths
|
||||
|
||||
This is a custom index for a directory
|
||||
|
||||
{{LIST}}
|
||||
168
site/index.md
168
site/index.md
@@ -30,171 +30,9 @@ 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)
|
||||
- Clickable markdown header anchors
|
||||
- Mobile responsive layout
|
||||
|
||||
If you want to **force** a file to be inlined, use `\!![]` instead of `\![]`
|
||||
- Customisable directory index pages with `{{LIST}}`
|
||||
|
||||
***
|
||||
|
||||
## 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>`
|
||||
- `\` works the same, with `alt` used for images
|
||||
- `\!![]` and `\!` 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
|
||||
|
||||
***
|
||||
|
||||
>[!WARNING]
|
||||
>The base that all of this is built upon was coded at night, while sleepy and a bit sick, and after walking for about 4 hours around a forest, so...
|
||||
> [!WARNING]
|
||||
> The base that all of this is built upon was coded at night, while sleepy and a bit sick, and after walking for about 4 hours around a forest, so...
|
||||
|
||||
@@ -9,7 +9,7 @@ display_logo = false
|
||||
display_title = true
|
||||
logo_as_favicon = false
|
||||
favicon = "favicon.ico"
|
||||
order = ""
|
||||
order = "Home, Docs, depths, Heaven"
|
||||
home_name = "Home"
|
||||
show_home_in_nav = true
|
||||
nav_links = ""
|
||||
@@ -20,3 +20,6 @@ versioning = true
|
||||
enable_header_links = true
|
||||
base_url = "https://kewt.krzak.org"
|
||||
custom_admonitions = ""
|
||||
generate_feed = false
|
||||
feed_file = "rss.xml"
|
||||
posts_dir = ""
|
||||
Reference in New Issue
Block a user