Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/lolorenzo777/zazzy
Zazzy is a simple Static Site Generator, written in Go.
zazzy
is an extended version of the sz
extremely minimal static site generator written in Go. sz
itself was inspired by zas
generator.
watch
feature for live generation during dev.LESS
or any other CSS prprocessorDownload the binaries from Github or build it manually:
go get github.com/larry868/zazzy
Install it:
go install github.com/larry868/zazzy
Then run zazzy in the directory of your website:
cd {mywebsite}
export ZS_PUBDIR=docs && zazzy build
Keep your texts in markdown or HTML format right in the main directory of your blog/site.
Keep all service files (extensions, layout pages, deployment scripts etc)
in the .zazzy
subdirectory.
Define variables in the header of the content files using YAML:
title: My web site
keywords: best website, hello, world
---
Markdown text goes after a header *separator*
Use placeholders for variables and plugins in your markdown or html
files, e.g. {{ title }}
or {{ command arg1 arg2 }}
.
Write extensions in any language you like and put them into the .zazzy
subdiretory.
Everything the extensions prints to stdout becomes the value of the placeholder.
Every variable from the content header will be passed via environment variables like title
becomes $ZS_TITLE
and so on. There are some special variables:
$ZS
- a path to the zs
executable$ZS_OUTDIR
- a path to the directory with generated files$ZS_FILE
- a path to the currently processed markdown file$ZS_URL
- a URL for the currently generated pagelayout:
defines the .html
file to be used as the layout. By default, the .zazzy/layout.html
will be used. If none of these files are founded, the file is processed without any layout.title:
define the title of the page. By default this is the name of the filedescription
define the description of the page. Nothing by default.url
define the URL for the generated page. By default this is the markdown filename with the .html
extension.Hidden directories and files, and the one starting with a .
are ignored. They're not processed and will not be generated to the published directory.
You can also list files to ignore into the .zazzy/.ignore
file. Each line must represents the glob pattern of filenames to ignore.
# example of .zazzy/.ignore file
# ignore the readme.md file in the working directory
readme.md
# ignore the test directory and all its content
test**
# ignote all txt files
*.txt
The published directory is always ignored. You don't need to include it in the .ignore file. For example if your website aims to be published to Github Pages, the docs
directory will be ignored from the generation.
To publish your website to Github Pages you've limited choice for the published directory, it's either the root of your repository or the docs
directory of your repository.
So with zazzy it's easy, you just have to set the $SZ_PUBDIR environnement variable to docs
and that's it.
The command to run the build looks like that:
$SZ_PUBDIR=docs zazzy build
Create your partial file into the .zazzy
directory. Partials can be .html
or .md
files.
Then insert it's placeholder whenever you want into your other files (could be the layout too).
For example if you've created the file .zazzy/footer.html
and you want to use it into the index.md
, then add the following code into this file:
{{ footer.html }}
It's important not to add any quotes or file extension, only the file name, working as a variable.
The rendering of partials is recursive, that means in our example footer.htlm can include a placholder to embedd another partial.
If you're familiar with the go html template package then you can use it's syntax directly within your html layout.
To avoid conflict with zazzy placeholder symbols {{
and }}
then the html templating syntax must be call with <%
and %>
symbols.
renderlist
placeholder {{ renderlist {pattern} }}
run special command to parse itemlayout html for every file in the list correspondinf to the pattern. Usefull to generate a list of blog entries.
Default layout for items is itemlayout.html
but can be specified in YAML environment variable of the page where the placeholder is found.
favicon
placeholder {{ favicon {website} }}
run special command to download and generate html to render thefavicon image.
To generate a sitemap then declare ZS_SITEMAPTYPE=txt
in your environmetnt variable, then add the YAML entry sitemap: true
in every markdown
and html
files you want to seein the sitemap.
Extensions can be written in any language you know (Bash, Python, Lua, JavaScript, Go, even Assembler). Here's an example of how to scan all markdown blog posts and create RSS items:
for f in ./blog/*.md ; doc
d=$($ZS var $f date)
if [ ! -z $d ] ; then
timestamp=`date --date "$d" +%s`
url=`$ZS var $f url`
title=`$ZS var $f title | tr A-Z a-z`
descr=`$ZS var $f description`
echo $timestamp \
"<item>" \
"<title>$title</title>" \
"<link>http://zserge.com/$url</link>" \
"<description>$descr</description>" \
"<pubDate>$(date --date @$timestamp -R)</pubDate>" \
"<guid>http://zserge.com/$url</guid>" \
"</item>"
fi
done | sort -r -n | cut -d' ' -f2-
There are two special plugin names that are executed every time the build
happens - prehook
and posthook
. You can define some global actions here like
content generation, or additional commands, like LESS to CSS conversion:
# .zs/post
#!/bin/sh
lessc < $ZS_OUTDIR/styles.less > $ZS_OUTDIR/styles.css
rm -f $ZS_OUTDIR/styles.css
zazzy init <title> <hosturl> [--vscode] [--ghpages] [--sitemap]
create a fresh new website with default files and path
zazzy build
re-builds your site.
zazzy build <file>
re-builds one file and prints resulting content to stdout.
zazzy watch
rebuilds your site every time you modify any file.
zazzy var <filename> [var1 var2...]
prints a list of variables defined in the
header of a given markdown file, or the values of certain variables (even if
it's an empty string).
Fork of zs
version commit 4900afa45db4d9254110f2eabcac6cfd606423b6
{{ renderlist {pattern} }}
.zazzy/.ignore
file allows to list files and directories to be igniorred from the processorZazzy is published and available in the go public package manager https://pkg.go.dev/github.com/larry868/zazzy
GOPROXY=proxy.golang.org go list -m github.com/larry868/zazzy@vx.y.z
The software is distributed under the MIT license.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.