initial commit
This commit is contained in:
7
LICENSE
Normal file
7
LICENSE
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright © 2024 Lucia Ceionia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
51
Makefile
Normal file
51
Makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
# ---------- OUTPUT FILES ----------
|
||||
# Add new files for the final site here!
|
||||
# The build & template rules will try to create them
|
||||
|
||||
files = index.html site.css using.html templates.html Makefile
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
|
||||
# If the OUTDIR variable does not exist, create it with a default
|
||||
ifeq ($(OUTDIR),)
|
||||
OUTDIR=out
|
||||
endif
|
||||
|
||||
# Construct the full output list
|
||||
LIST=$(addprefix $(OUTDIR)/, $(files))
|
||||
|
||||
# Just `make` should build our whole output list
|
||||
all: $(LIST)
|
||||
|
||||
# Automatic directory creation
|
||||
# https://ismail.badawi.io/blog/automatic-directory-creation-in-make/
|
||||
.PRECIOUS: $(OUTDIR)/. $(OUTDIR)%/.
|
||||
$(OUTDIR)/: ; mkdir -p $@
|
||||
$(OUTDIR)%/: ; mkdir -p $@
|
||||
.SECONDEXPANSION:
|
||||
|
||||
# `make clean` just removes our OUTDIR
|
||||
clean:
|
||||
rm -rf $(OUTDIR)
|
||||
|
||||
|
||||
# ---------- BUILD & TEMPLATE RULES ----------
|
||||
|
||||
# Default template - .html (base-start.html + content + base-end.html)
|
||||
$(OUTDIR)/%.html: src/%.html | $$(@D)/
|
||||
cat templates/base-start.html $< templates/base-end.html > $@
|
||||
|
||||
# Bare template - .bare.html (just copy)
|
||||
$(OUTDIR)/%.html: src/%.bare.html | $$(@D)/
|
||||
cp $< $@
|
||||
|
||||
# Create .html from .md using kramdown
|
||||
src/%.html: src/%.md | $$(@D)/
|
||||
kramdown $< > $@
|
||||
|
||||
# Other files - just copy
|
||||
$(OUTDIR)/%: src/% | $$(@D)/
|
||||
cp $< $@
|
||||
|
||||
# --------------------------------------------
|
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Lucy's Makefile Static Site Generator for GNU/Linux
|
||||
|
||||
so here's how i make my site. if you'd like to you can build one with this as well! what does it actually do? well...
|
||||
|
||||
- templating
|
||||
- markdown support (with kramdown)
|
||||
- completely extendable! it's just a makefile
|
||||
|
||||
"that's all?" yep. this is just my tool for making simple sites. i like it :3
|
||||
how do you use it?
|
||||
|
||||
- [basic usage](https://ceionia.com/ssg-example/using.html)
|
||||
- [using templates](https://ceionia.com/ssg-example/templates.html)
|
||||
|
||||
if you make your makefile do something cool, share it! maybe someone else will use it too ♥
|
51
src/Makefile
Normal file
51
src/Makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
# ---------- OUTPUT FILES ----------
|
||||
# Add new files for the final site here!
|
||||
# The build & template rules will try to create them
|
||||
|
||||
files = index.html
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
|
||||
# If the OUTDIR variable does not exist, create it with a default
|
||||
ifeq ($(OUTDIR),)
|
||||
OUTDIR=out
|
||||
endif
|
||||
|
||||
# Construct the full output list
|
||||
LIST=$(addprefix $(OUTDIR)/, $(files))
|
||||
|
||||
# Just `make` should build our whole output list
|
||||
all: $(LIST)
|
||||
|
||||
# Automatic directory creation
|
||||
# https://ismail.badawi.io/blog/automatic-directory-creation-in-make/
|
||||
.PRECIOUS: $(OUTDIR)/. $(OUTDIR)%/.
|
||||
$(OUTDIR)/: ; mkdir -p $@
|
||||
$(OUTDIR)%/: ; mkdir -p $@
|
||||
.SECONDEXPANSION:
|
||||
|
||||
# `make clean` just removes our OUTDIR
|
||||
clean:
|
||||
rm -rf $(OUTDIR)
|
||||
|
||||
|
||||
# ---------- BUILD & TEMPLATE RULES ----------
|
||||
|
||||
# Default template - .html (base-start.html + content + base-end.html)
|
||||
$(OUTDIR)/%.html: src/%.html | $$(@D)/
|
||||
cat templates/base-start.html $< templates/base-end.html > $@
|
||||
|
||||
# Bare template - .bare.html (just copy)
|
||||
$(OUTDIR)/%.html: src/%.bare.html | $$(@D)/
|
||||
cp $< $@
|
||||
|
||||
# Create .html from .md using kramdown
|
||||
src/%.html: src/%.md | $$(@D)/
|
||||
kramdown $< > $@
|
||||
|
||||
# Other files - just copy
|
||||
$(OUTDIR)/%: src/% | $$(@D)/
|
||||
cp $< $@
|
||||
|
||||
# --------------------------------------------
|
25
src/index.html
Normal file
25
src/index.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<h1>Lucy's Makefile Static Site Generator for GNU/Linux</h1>
|
||||
<p>so here's how i make my site. if you'd like to you can build one with this as well! what does it actually do? well...</p>
|
||||
<ul>
|
||||
<li>templating</li>
|
||||
<li>markdown support (with kramdown)</li>
|
||||
<li>completely extendable! it's just a makefile</li>
|
||||
</ul>
|
||||
<p>"that's all?" yep. this is just my tool for making simple sites. i like it :3</p>
|
||||
<p>how do you use it?</p>
|
||||
<ul>
|
||||
<li><a href="using.html">basic usage</a></li>
|
||||
<li><a href="templates.html">using templates</a></li>
|
||||
</ul>
|
||||
<p>you can get the software from this <a href="https://git.ceionia.com/lucia/LucysSSG">example site's repository</a>, or just get the <a href="Makefile">base Makefile</a>.</p>
|
||||
<p>if you make your makefile do something cool, share it! maybe someone else will use it too ♥</p>
|
||||
<details style="white-space:preserve-breaks;">
|
||||
<summary>This is released under the <a href="https://en.wikipedia.org/wiki/MIT_License">MIT license</a></summary>
|
||||
Copyright © 2024 Lucia Ceionia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</details>
|
33
src/site.css
Normal file
33
src/site.css
Normal file
@@ -0,0 +1,33 @@
|
||||
header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
color: #dbdbdb;
|
||||
background-color: #272826;
|
||||
padding-top: 0.5em;
|
||||
height: 1.75em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 1.5em;
|
||||
color: #dbdbdb;
|
||||
background-color: #272826;
|
||||
padding-top: 0.5em;
|
||||
height: 1.75em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
code { white-space: pre; }
|
||||
a { color: inherit; }
|
||||
body { background-color: #bbb; }
|
||||
.inner {
|
||||
margin: 3em 1ch 3em 1ch;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
44
src/templates.md
Normal file
44
src/templates.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Templates
|
||||
|
||||
### default template
|
||||
|
||||
---
|
||||
|
||||
`templates/base-start.html` and `templates/base-end.html` are used as the default template, for all .html files (and .html processed from .md).
|
||||
|
||||
when you build your site, the content of `templates/base-start.html` will be added before each page's content, and `templates/base-end.html` after.
|
||||
|
||||
to not apply the template to a page, use `.bare.html`/`.bare.md` as the extension.
|
||||
|
||||
|
||||
### adding a template
|
||||
|
||||
---
|
||||
|
||||
to add a template, add a rule to the makefile. you can use the default template as reference:
|
||||
```
|
||||
# Default template - .html (base-start.html + content + base-end.html)
|
||||
$(OUTDIR)/%.html: src/%.html | $$(@D)/
|
||||
cat templates/base-start.html $< templates/base-end.html > $@
|
||||
```
|
||||
|
||||
as an example, to create a new template which will work on all files ending in `.media.html`, add the following rule to the build & template rules section:
|
||||
```
|
||||
$(OUTDIR)/%.html: src/%.media.html | $$(@D)/
|
||||
cat templates/media-start.html $< templates/media-end.html > $@
|
||||
```
|
||||
don't forget to create `templates/media-start.html` and `templates/media-end.html`
|
||||
note `src/%.media.html` in the first line, this matches any file in `src/` ending with `.media.html`. the output then is `$(OUTDIR)/%.html`, with `.html` instead of `.media.html` - we don't want the template selector in the final output name.
|
||||
|
||||
|
||||
### removing a template
|
||||
|
||||
---
|
||||
|
||||
to remove a template, simply delete its rule from the makefile.
|
||||
for example, to delete the default template, remove the following lines:
|
||||
```
|
||||
# Default template - .html (base-start.html + content + base-end.html)
|
||||
$(OUTDIR)/%.html: src/%.html | $$(@D)/
|
||||
cat templates/base-start.html $< templates/base-end.html > $@
|
||||
```
|
32
src/using.md
Normal file
32
src/using.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Basic Usage
|
||||
|
||||
### set up
|
||||
|
||||
---
|
||||
|
||||
first off, you'll need Linux and GNU make. things might work on *nix without GNU tools, but no promises. for markdown support, you'll need [kramdown](https://kramdown.gettalong.org/).
|
||||
clone this [example site repository](https://git.ceionia.com/lucia/LucysSSG), or get the base Makefile [here](Makefile).
|
||||
your input files go in the `src/` directory. modify the `files` field at the top of the Makefile to add new outputs.
|
||||
for example, to produce `out/index.html` and `out/site.css` from `src/index.md` and `src/site.css`, your files field should look like this:
|
||||
```
|
||||
files = index.html site.css
|
||||
```
|
||||
|
||||
the default Makefile uses `templates/base-start.html` and `templates/base-end.html` at the start and end of each `.html` output file. simply remove the default template rule ([see template guide](templates.html)) to stop this.
|
||||
|
||||
|
||||
|
||||
### building your site
|
||||
|
||||
---
|
||||
|
||||
run `make`. the makefile will generate your output files in `out/` by default (you can change this with the OUTDIR environment variable, `OUTDIR=../web make`, or directly in the Makefile).
|
||||
`make clean` will remove the OUTDIR.
|
||||
|
||||
|
||||
|
||||
### hosting your site
|
||||
|
||||
---
|
||||
|
||||
i use [nginx](https://nginx.org/) on an [arch linux](https://archlinux.org/) server. if you don't have a server, i've heard good things about [neocities](https://neocities.org/), you should be able to just upload the files created by this.
|
3
templates/base-end.html
Normal file
3
templates/base-end.html
Normal file
@@ -0,0 +1,3 @@
|
||||
</div>
|
||||
<footer>interesting footer text</footer>
|
||||
</html>
|
10
templates/base-start.html
Normal file
10
templates/base-start.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lucy's SSG</title>
|
||||
<link href="site.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header>Lucy's SSG - <a href="index.html">About</a> - <a href="using.html">Basic Usage</a> - <a href="templates.html">Templates</a></header>
|
||||
<div class="inner">
|
Reference in New Issue
Block a user