Introduce blorg: MVP static site generator
hugo is nice - but it's huge. I've never built a static site generator before and thought the world could use one more - it's not like there's already enough choice out there! No, but seriously. I love hugo and it has all the bells and whistles and you should definitely use that and not this. I just like reinventing the wheel to learn about stuff - and I like the 80/20 rule. This gives like 60% of what I want already and is tiny fraction of hugo in terms of LOC (hugo without it's bazillion dependencies is like 80k+ - this is like 500 and very likely won't ever grow above let's say 5k). Also org mode is awesome and why not use it as a configuration format as well. Let's see where this goes. YOLO.
This commit is contained in:
parent
5e50794af0
commit
30dd2794cf
16 changed files with 760 additions and 33 deletions
100
blorg/testdata/blorg.org
vendored
Normal file
100
blorg/testdata/blorg.org
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
#+AUTHOR: author
|
||||
#+TITLE: blog
|
||||
#+BASE_URL: https://www.example.com
|
||||
#+OPTIONS: toc:nil
|
||||
#+CONTENT: ./content
|
||||
#+PUBLIC: ./public
|
||||
|
||||
* templates
|
||||
** head
|
||||
#+name: head
|
||||
#+begin_src html
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/style.css" type="text/css" />
|
||||
<title>{{ .Title }}</title>
|
||||
</head>
|
||||
#+end_src
|
||||
** header
|
||||
#+name: header
|
||||
#+begin_src html
|
||||
<header class='header'>
|
||||
<a class="logo" href="/">home</a>
|
||||
<nav>
|
||||
<a href="https://www.github.com/niklasfasching">github</a>
|
||||
<a href="/about">about</a>
|
||||
</nav>
|
||||
</header>
|
||||
#+end_src
|
||||
** index
|
||||
#+name: index
|
||||
#+begin_src html
|
||||
<!doctype html>
|
||||
<html>
|
||||
{{ template "head" . }}
|
||||
<body>
|
||||
{{ template "header" . }}
|
||||
<h1 class="title">{{ .Title }}</h1>
|
||||
<ul class="posts">
|
||||
{{ range .Pages }}
|
||||
<li class="post">
|
||||
<a href="{{ .PermaLink }}">
|
||||
<date>{{ .Date.Format "02.01.2006" }}</date>
|
||||
<span>{{ .Title }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
#+end_src
|
||||
** item
|
||||
#+name: item
|
||||
#+begin_src html
|
||||
<!doctype html>
|
||||
<html>
|
||||
{{ template "head" . }}
|
||||
<body>
|
||||
{{ template "header" . }}
|
||||
<div class="container">
|
||||
<h1 class="title">{{ .Title }}
|
||||
<br>
|
||||
<span class="subtitle">{{ .Subtitle }}</span>
|
||||
</h1>
|
||||
<ul class="tags">
|
||||
{{ range .Tags }}
|
||||
<li><a href="/tags/{{ . | Slugify }}">{{ . }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ .Content }}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
#+end_src
|
||||
|
||||
** list
|
||||
#+name: list
|
||||
#+begin_src html
|
||||
<!doctype html>
|
||||
<html>
|
||||
{{ template "head" . }}
|
||||
<body>
|
||||
{{ template "header" . }}
|
||||
<div class="container">
|
||||
<h1 class="title">{{ .Title }}</h1>
|
||||
<ul class="posts">
|
||||
{{ range .Pages }}
|
||||
<li class="post">
|
||||
<a href="{{ .PermaLink }}">
|
||||
<date>{{ .Date.Format "02.01.2006" }}</date>
|
||||
<span>{{ .Title }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
<ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
#+end_src
|
4
blorg/testdata/content/about.org
vendored
Normal file
4
blorg/testdata/content/about.org
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
#+TITLE: About
|
||||
#+TAG[]: static
|
||||
|
||||
and some content
|
2
blorg/testdata/content/post.org
vendored
Normal file
2
blorg/testdata/content/post.org
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
#+TITLE: some post
|
||||
#+TAG[]: post
|
37
blorg/testdata/public/about.html
vendored
Normal file
37
blorg/testdata/public/about.html
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/style.css" type="text/css" />
|
||||
<title>About</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class='header'>
|
||||
<a class="logo" href="/">home</a>
|
||||
<nav>
|
||||
<a href="https://www.github.com/niklasfasching">github</a>
|
||||
<a href="/about">about</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="title">About
|
||||
<br>
|
||||
<span class="subtitle"></span>
|
||||
</h1>
|
||||
<ul class="tags">
|
||||
|
||||
</ul>
|
||||
<h1 class="title"><p>
|
||||
About
|
||||
</p>
|
||||
</h1>
|
||||
<p>
|
||||
and some content
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
24
blorg/testdata/public/index.html
vendored
Normal file
24
blorg/testdata/public/index.html
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/style.css" type="text/css" />
|
||||
<title>blog</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class='header'>
|
||||
<a class="logo" href="/">home</a>
|
||||
<nav>
|
||||
<a href="https://www.github.com/niklasfasching">github</a>
|
||||
<a href="/about">about</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<h1 class="title">blog</h1>
|
||||
<ul class="posts">
|
||||
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
34
blorg/testdata/public/post.html
vendored
Normal file
34
blorg/testdata/public/post.html
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/style.css" type="text/css" />
|
||||
<title>some post</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class='header'>
|
||||
<a class="logo" href="/">home</a>
|
||||
<nav>
|
||||
<a href="https://www.github.com/niklasfasching">github</a>
|
||||
<a href="/about">about</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="title">some post
|
||||
<br>
|
||||
<span class="subtitle"></span>
|
||||
</h1>
|
||||
<ul class="tags">
|
||||
|
||||
</ul>
|
||||
<h1 class="title"><p>
|
||||
some post
|
||||
</p>
|
||||
</h1>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
34
blorg/testdata/public/tag/post/index.html
vendored
Normal file
34
blorg/testdata/public/tag/post/index.html
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/style.css" type="text/css" />
|
||||
<title>Post</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class='header'>
|
||||
<a class="logo" href="/">home</a>
|
||||
<nav>
|
||||
<a href="https://www.github.com/niklasfasching">github</a>
|
||||
<a href="/about">about</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="title">Post</h1>
|
||||
<ul class="posts">
|
||||
|
||||
<li class="post">
|
||||
<a href="/post.html">
|
||||
<date>01.01.1970</date>
|
||||
<span>some post</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
34
blorg/testdata/public/tag/static/index.html
vendored
Normal file
34
blorg/testdata/public/tag/static/index.html
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="stylesheet" href="/style.css" type="text/css" />
|
||||
<title>Static</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class='header'>
|
||||
<a class="logo" href="/">home</a>
|
||||
<nav>
|
||||
<a href="https://www.github.com/niklasfasching">github</a>
|
||||
<a href="/about">about</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<h1 class="title">Static</h1>
|
||||
<ul class="posts">
|
||||
|
||||
<li class="post">
|
||||
<a href="/about.html">
|
||||
<date>01.01.1970</date>
|
||||
<span>About</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue