create template for gemini placename

This commit is contained in:
nebula 2025-04-06 21:26:36 +00:00
parent a31b94af8d
commit c5027c45e0
3 changed files with 16 additions and 9 deletions

View File

@ -146,20 +146,21 @@ def render_gemini_index():
def render_gemini_places():
post_paths = glob(md_dir + "*")
template = template_environment.get_template("gemini_place")
for post_path in post_paths:
post_name = path.basename(post_path).split('/')[-1][:-3]
with open(post_path, "r") as f:
content = f.read()
process = Popen(["gemgen"], stdout=PIPE, stdin=PIPE, stderr=PIPE, text=True)
gemtext = process.communicate(input=content)[0]
gemtext_with_local_urls = name_from_url.sub(sub_http_local_urls, gemtext)
with open(gemini_out_dir + post_name + ".gmi", "w") as f:
header = f"""=> / Index
## {metadata[post_name]["title"]}, {metadata[post_name]["state"]}
=> https://helixnebula.space/{post_name}/ Link to photography.
"""
gemtext = process.communicate(input=content)[0]
gemtext_with_local_urls = name_from_url.sub(sub_http_local_urls, gemtext)
f.write(header + gemtext_with_local_urls)
f.write(template.render({
"post_code": post_name,
"post_body": gemtext_with_local_urls,
"post_title": metadata[post_name]["title"],
"state": metadata[post_name]["state"]
}))
def copy_files():
call("cp js/* html/js/", shell=True)

View File

@ -4,7 +4,7 @@ I have spent countless hours dedicated to enjoying and capturing the natural won
## Gemspace Info
This is my gemspace, where I share stories from my travels. My posts from the http version of helixnebula.space are mirrored here. The http version also includes a very large amount of photography for these locations and more. Here on this space, you will find the stories I have written for those albums. More of these posts will be written with time, so check back later to see if there is more.
This is my gemspace, where I share stories from my travels. My text posts from the http version of helixnebula.space are mirrored here. The http version also includes a very large amount of photography for these locations and more. Here on this gemspace, you will find the stories I have written for those albums. More of these posts will be written with time, so check back later to see if there is more.
=> https://helixnebula.space/ View my photography site!

6
templates/gemini_place Normal file
View File

@ -0,0 +1,6 @@
=> / Index
### {{ post_title }}, {{ state }}
=> https://helixnebula.space/{{ post_code }}/ Link to photography.
{{ post_body }}