ZEHD is a static site generator that streamlines the process of converting markdown, org-mode, and gohtml/html files to HTML. Similar to Hugo, ZEHD allows users to automatically create paths and parse their files. The key difference is that ZEHD removes the extra steps required to convert markdown to HTML, as it can do this automatically.
ZEHD has several main features:
- Building gohtml/html files
- Converting org-mode files to HTML
- Converting markdown to HTML
- Caching to eliminate the need for service restarts
- Git integration for easy content management
ZEHD supports Go templates with the .gohtml extension, and standard HTML files with the .html extension. These templates can include Go template language constructs such as control structures, loops, and functions, and can be used to generate dynamic content.
In addition to markdown, ZEHD can also convert org-mode files to HTML. Org-mode is a powerful markup language that supports outlining, notes, lists, tables, and other advanced features.
Like other static site generators, ZEHD can also convert markdown files to HTML. The conversion is handled by the Blackfriday Markdown processor.
One of the key benefits of ZEHD is its caching functionality. This eliminates the need to restart the service when new content is added or updated, and ensures that content is delivered quickly to users.
Here's an example of a simple Go template:
<!-- layout.gohtml -->
{{ define "layout" }}
<!DOCTYPE html>
<html>
<head>
<title>{{template "title"}}</title>
</head>
<body>
{{template "templatePart"}}
</body>
</html>
{{ end }}
<!-- pagename.gohtml -->
{{define "title"}}
<h1>
The name of my Title
</h1>
{{end}}
{{define "templatePart"}}
<div>
<p>
Whatever HTML you want to have displayed
</p>
</div>
{{end}}
ZEHD can be easily configured using environment variables. Here's a comprehensive list of available options:
BACKEND="http://YourBackend.example.com:8080"
HOSTNAME="ZEHD"
LOGLOCATION="/var/log/app/"
LOGLEVEL="DEBUG"
APP_NAME="your-app"
TEMPLATEDIRECTORY="/var/zehd/templates"
TEMPLATETYPE="gohtml"
REFRESHCACHE="60"
PROFILER=false
GITLINK=""
GITUSERNAME=""
GITTOKEN=""
JSPATH=""
CSSPATH=""
IMAGESPATH=""
DOWNLOADSPATH=""
ZEHD now supports automatic content management through Git integration. By specifying a Git repository URL, ZEHD will automatically clone the repository and fetch any changes you make. This eliminates the need for manual uploads or downloads to update your site content.
To use this feature:
- Set the
GITLINK
environment variable to your repository URL. - If your repository is private, also set
GITUSERNAME
andGITTOKEN
. - ZEHD will automatically clone the repository on startup and periodically fetch updates.
This feature allows for a more streamlined workflow, enabling you to manage your site content directly through your Git repository.
To try or run ZEHD on Docker:
docker pull zehd/zehd:latest
docker run -d --name zehd \
-e BACKEND=http://your-backend-url:8080 \
-e GITLINK=https://github.com/your-username/your-repo.git \
-e GITUSERNAME=your-username \
-e GITTOKEN=your-token \
-p 80:80 \
zehd/zehd:latest
Adjust the environment variables as needed for your setup.
For collecting data on site visitors, check out the backend service: https://github.com/APoniatowski/zehd-backend
- Implementing a worker/agent for dynamic IP/hostname banning
- Adding frontend-to-backend calls to check for banned IPs/hostnames
- Expanding Git integration features
- Inter-service replication, to save time on git pulls/clones or upload/downloads (PLANNED)
To get started with ZEHD:
- Clone the ZEHD repository or pull the Docker image
- Set up your environment variables as described above
- If using Git integration, ensure your content repository is set up and accessible
- Run ZEHD
- Access your site through the configured port (default: 80)
For more detailed instructions, please refer to the documentation (link to be added).
Contributions are welcome! Please feel free to submit a Pull Request.
[https://github.com/APoniatowski/zehd/blob/main/LICENSE]
Package | Test | Runs | ns/op | B/op | allocs/op |
---|---|---|---|---|---|
zehd/pkg/caching | BenchmarkCachePages | 8460 | 145314 | 10734 | 97 |
zehd/pkg/caching | BenchmarkTemplateBuilder | 8739 | 146341 | 17671 | 115 |