Commit graph

10 commits

Author SHA1 Message Date
mntn
c80b72613d
Clean up templates and unify template metadata
This exposes more site-specific information to templates. Top-level
_index(.gmi).md is now treated by the templating code the same
way per-directory indices are (which introduces a breaking change:
top-level posts now receive .Posts instead of .PostData).

Web-specific metadata is now removed from the RSS.

This makes gmnhg usable out of the box to generate a reasonable
site with zero configuration even with pages with no metadata.
2021-09-22 02:29:14 +05:00
mntn
372646033c
Use same variable names as Hugo
This makes gmnhg use settings from Hugo by default, allowing
to override variables in a separate gmnhg section.

Currently the templates use baseUrl, title, languageCode and
copyright.

Fixes #29.
2021-09-20 22:20:40 +05:00
mntn
3110ac629c
Update default templates to use new metadata
This updates default gmnhg templates to new field names
after changes introduced after recent major refactoring.

Fixup 9778ada128.
2021-09-20 03:19:29 +05:00
mntn
2de6e634d6
Add RSS support
This implements RSS timeline generation in gmnhg.

RSS is generated both for the whole site, and for the content
directories as an rss.xml file inside these directories.

RSS requires the absolute URI to the article. For this to work,
a geminiBaseURL setting is required to be set in the Hugo
configuration file (config.toml/json/yaml).

RSS template can be ovewritten on the site-wide /
directory-wise basis; see godoc on how to do this.

As there's no discovery method of an RSS timeline in Gemini,
the users are expected to put a link to rss.xml on their site
where necessary.
2021-09-12 16:26:33 +05:00
Timur Demin
b4ae1981d6
Implement sort / sortRev in templates
This adds generic sort / sortRev functions for use in gmnhg templates
which use sort.Sort to sort anything that implements sort.Interface
(which includes lists of posts).

The existing sortPosts function that used to sort posts in reverse order
becomes an alias to sortRev for backwards compatibility.
2021-08-22 17:52:19 +03:00
Timur Demin
7fba4182e1
Run gofmt on templates.go 2021-08-22 15:34:30 +03:00
mntn
0ac0476e62
Integrate sprig v3 for improved templating (#9) 2021-08-16 20:29:13 +05:00
Timur Demin
ae794d9d59
Comment on sortPosts behaviour 2021-02-19 16:47:14 +05:00
Timur Demin
9d16372487
Implement sourcing _index.md content
Fixes #5. The Markdown content is sourced from _index.gmi.md so we don't
interfere with native Web content.
2020-11-19 21:12:59 +05:00
Timur Demin
1a0e61dc3f
Implement gmnhg
gmnhg is the new program that generates a Gemini site from Hugo site
content. It reads its input from content/, static/, and layouts/gmnhg/.
Its output by default goes to output/.

More doc is available in the program doc header.
2020-11-18 22:23:31 +05:00