Skip to content
Brendan Kidwell edited this page Jun 23, 2014 · 8 revisions

You can use Zim to create a web site. Here is one simple way to do it:

  1. Create a new folder for the project. We'll call it foo.

  2. Under foo create two folders scripts and src.

  3. Open foo/src as a Zim notebook. Make the Home Page of your notebook a page called index .

  4. Create a file in scripts called build.sh:

     #!/bin/bash
     cd "`dirname "$0"`"
     cd ..
     
     mkdir -p build
     cd build
     [ -e _resources ] && rm -rf *
     cd ..
     zim --export \
       --format=html --template=Print \
       --output=./build --index-page=sitemap \
       src
    

    Use your command prompt or file manager to make this file executable.

Put whatever text and images you want in your Zim notebook in the src folder. When you're ready, run build.sh to convert the notebook to HTML in the build folder. You can browse your web site in there.

To publish your web site, just upload the contents of the build folder to your hosting provider.

Project Folder Layout

foo
├── build
│   └── (HTML files)
├── src
│   └── (Zim notebook files)
└── scripts
    ├── build.sh (for Unix operating systems)
    └── build.cmd (for Windows)

Alternate Build Script for Windows

If you're using Windows, you should use this batch file build.cmd in the scripts folder instead of build.sh from above:

@echo off

set ZIM=C:\Program Files (x86)\Zim Desktop Wiki\zim.exe
if not exist "%ZIM%" set ZIM=C:\Program Files\Zim Desktop Wiki\zim.exe
if not exist "%ZIM%" set ZIM=zim.exe

cd /d "%~dp0"
cd ..

mkdir build 2>NUL
cd build
if exist _resources del /s /q *.* >NUL
cd ..
"%ZIM%" --export ^
  --format=html --template=Print ^
  --output=./build --index-page=sitemap ^
  src
Clone this wiki locally