diff --git a/generate.py b/generate.py index 6cfa883..e7bef1c 100644 --- a/generate.py +++ b/generate.py @@ -12,7 +12,6 @@ import datetime numbers_re = re.compile("[0-9]+") name_from_url_re = re.compile(r"https:\/\/helixnebula.space/(.*)/") -md_links_re = re.compile(r"\[([^\]]*)\]\([^\)]*\)") out_dir = "/var/www/html/" gemini_out_dir = "/var/gemini/" base_url = "https://helixnebula.space/" @@ -95,11 +94,7 @@ def render_index(): data = {key: value for key, value in sorted(metadata.items(), key=lambda item: item[1]['title'])} photo_counts = {placename: metadata[placename]["count"] for placename in metadata.keys()} total_count = 0 - posts = [ - path.basename(post).split('/')[-1][:-3] for post in - glob(md_dir + "*") - ] - posts.sort() + posts = sorted(story_names, key=lambda x: metadata[x]["story_time"], reverse=True) for _, info in metadata.items(): total_count = info["count"] + total_count with open(out_dir + "index.html", "w") as f: @@ -152,10 +147,11 @@ def sub_http_local_urls(match): def render_gemini_index(): template = template_environment.get_template("gemini_main") + stories = [(post_code, metadata[post_code]) for post_code in story_names] + stories.sort(key=lambda i: i[1]["story_time"], reverse=True) with open(gemini_out_dir + "index.gmi", "w") as f: f.write(template.render({ - "post_info": {post_name: metadata[post_name]["title"] for post_name in story_names}, - "post_states": {post_name: metadata[post_name]["state"] for post_name in story_names} + "story_data": stories })) def render_gemini_places(): diff --git a/metadata.json b/metadata.json index a25a0dc..4916614 100644 --- a/metadata.json +++ b/metadata.json @@ -116,7 +116,8 @@ "ElMalpais": { "title": "El Malpais National Monument", "state": "New Mexico", - "cover": "IMG_9669.JPEG" + "cover": "IMG_9669.JPEG", + "story_time": 1744493210 }, "CibolaGrants": { "title": "Cibola National Forest Near Grants", @@ -142,7 +143,8 @@ "VLA": { "title": "Very Large Array", "state": "New Mexico", - "cover": "IMG_6644.JPEG" + "cover": "IMG_6644.JPEG", + "story_time": 1744419715 }, "Phoenix": { "title": "Phoenix", diff --git a/templates/gemini_main b/templates/gemini_main index e278fe8..09da5bd 100644 --- a/templates/gemini_main +++ b/templates/gemini_main @@ -8,7 +8,26 @@ This is my gemspace, where I share stories from my travels. My text posts from t => https://helixnebula.space/ View my photography site! -## Posts +``` + , ' . ' , + . . ' . , + . ' + + + .-'''''-. + .' `. + . ________|| + ___ : : | / || . '___ + ____/ \ : : ||. _/ || ||\_______/ \ + / \ : _/| : `|| __/ ,.|| || \ +/ , ' . \ : =/_/ : |'_______ || || || . \ + | \__`._/ | .' ___| \__ \\|| ||... , \ + l|, ' ( / ,|...-' \ ' , __\||_//___ + ___|____ \_/^\/||__ , . ,__ ||// \ . , + _/~ `""~`"` \_ ''( ....,||/ ' + ..,... __/ -'/ `-._ `\_\__ | \ || _______ . + itz/jgs/ccm'` `\ \ \-.\ /(_1_,.. || / + ______/"""" +``` -{% for post_name, post_title in post_info.items() %}=> {{ post_name }}.gmi {{ post_title }}, {{ post_states[post_name] }} +## Posts (ordered by most recent) + +{% for story_code, metadata in story_data %}=> {{ story_code }}.gmi {{ metadata["title"] }}, {{ metadata["state"] }} {% endfor %} diff --git a/templates/main b/templates/main index 9807b8c..01901f4 100644 --- a/templates/main +++ b/templates/main @@ -42,6 +42,7 @@
Albums With Stories + Ordered by most recent first. {% for placename in posts %}
{{ metadata[placename]['title'] }}, {{ metadata[placename]['state'] }} [{{ metadata[placename]['count'] }}] @@ -50,6 +51,7 @@

Photos licensed under CC BY-NC-SA 4.0
Powered by free, open source software +
Available via Gemini protocol
Subscribe with your feed reader!