phlog

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 913630b0d479a576c4ec1d7daa425baf62c84635
parent 1805880d944f668dd5630ef59a056c28550c739c
Author: Charlie Stanton <charlie@shtanton.com>
Date:   Sat, 24 Jul 2021 14:18:48 +0100

Switch to shtanton.xyz

Diffstat:
Mgemini/index.gmi | 2+-
Mgemini/posts/all_the_protocols.gmi | 2+-
Agemini/posts/best_social_media.gmi | 9+++++++++
Dgemini/posts/build_process.gmi | 122-------------------------------------------------------------------------------
Mgemini/posts/ex.gmi | 2+-
Mgemini/posts/index.gmi | 6+++---
6 files changed, 15 insertions(+), 128 deletions(-)

diff --git a/gemini/index.gmi b/gemini/index.gmi @@ -2,4 +2,4 @@ I don't know what I'm doing but hopefully I don't give up on this space. -=> gemini://shtanton.com/posts Maybe I've written something on my gemlog recently +=> gemini://shtanton.xyz/posts Maybe I've written something on my gemlog recently diff --git a/gemini/posts/all_the_protocols.gmi b/gemini/posts/all_the_protocols.gmi @@ -20,5 +20,5 @@ to an RFC. Not necessarily one I use, just any of them. Hopefully this rant doesn't make me a hypocrite as someone who's never been to an IETF meeting, but I'll fix that soon enough, and I'd encourage you to do the same. -Feel free to email charlie@shtanton.com with any thoughts. Writing super long and well researched +Feel free to email charlie@shtanton.xyz with any thoughts. Writing super long and well researched posts is hard so I'm gonna try these short ones with the occasional longer one. diff --git a/gemini/posts/best_social_media.gmi b/gemini/posts/best_social_media.gmi @@ -0,0 +1,9 @@ +Social media websites are the only way most people on the internet have to express themselves. Which is really sad if you think about it, most people's only presence on the internet, is uploading data to other people's servers where they no longer have any control in it. + +There are a bunch of people, like me, who upload stuff to our own servers (very occasionally). It is marginally more expensive than social media (my server is a raspberry pi) but it enables me to say whatever I want, whenever I want to, to whoever I want. No one else owns the server where my posts live, so they can't stop me posting there. + +My gemlog posts are not that different to someone else's Twitter or Facebook posts, but I have 100 times as much freedom. We don't need social media sites, because the whole internet is social media. As a side note, I mean the whole internet, not just the web. + +If you are currently using much social media, consider whether you need it or not, since the internet itself already does everything we need, without being owned by a corporation. + +In conclusion, the internet is the best social media. diff --git a/gemini/posts/build_process.gmi b/gemini/posts/build_process.gmi @@ -1,122 +0,0 @@ -Obviously most sites in 2020 are enourmous beasts, running megabytes of -javascript on both the client and server. This one isn't, and I thought I'd take -some time to explain how it does work. I want to write an article critical of -the web as a whole at some point so I haven't put any reasoning for why it works -this way in this post. - -### This is no ordinary site - -This is both a blog and a phlog. All of the posts are available on both a -website and a gopher server, both at shtanton.com. If you haven't heard of -gopher, go have a look! I hadn't until recently but it is a lot of fun. I got -started -[here](https://cheapskatesguide.org/articles/gopherspace.html). - -### Server Side: HTTP - -There is basically nothing on the http server. It is a rust executable using -actix that serves files from a directory. All the pages on this site are just -html files. The only interesting thing it does is redirect / to /index.html. - -### Server Side: Gopher - -Even simpler, I didn't need a gopher server library since the protocol is -wonderfully simple. Again a rust executable is serving static files, and / -serves a file called index. - -### Server Hosting - -These are hosted on a debian buster server with vultr. I wrote a couple of -systemd unit files for my executables and they run 24/7 and autorestart should -they fail. - -### Client Side - -The phlog (gopher log) just serves the raw markdown files that I write, but the -blog has some additional styling. A tiny bit of css which uses css-grid to -layout the pages and make them responsive, as well as gruvbox colours. - -### Directory structure - -The project root has: - -- `config.json` - list of posts with metadata -- `gopher` - built gopher files -- `gopher_src` - scripts and templates for building gopher files -- `html` - built html files -- `html_src` - scripts and templates for building html files -- `posts` - post markdown files -- `gopher-server` - rust gopher server -- `web-server` - rust web server -- `publish.sh` - publish everything -- `Tupfile` - tupfile (see later) - -### Build process - -I've hinted that I write markdown posts but obviously they are published as -html. To generate all the pages for the site I've used a bunch of python scripts -connected together with tup, which I hadn't used before but I quite like now. So -far there are 4 python scripts: - -- `gopher_src/index.py` which generates the gopher index -- `html_src/index_html.py` which generates index.html -- `html_src/nav_html.py` which generates the nav menu snippet of html (not a - whole page) from a json list of posts. -- `html_src/post_html.py` which generates the post pages. - -These are all pretty simple but `html_src/post_html.py` is the most complex and -interesting so I'll break that down briefly. - - #!/usr/bin/python3.8 - import argparse, json, sys, os, subprocess, shutil - - parser = argparse.ArgumentParser(description="Generate html for post from markdown") - parser.add_argument("post", help="Post markdown file name") - args = parser.parse_args() - - with open(os.path.join("posts", args.post+".md"), encoding="utf-8") as post_file, open("config.json", encoding="utf-8") as config_file, open("html_src/post_template.html", encoding="utf-8") as template_file, open("html_src/nav.html", encoding="utf-8") as nav_file: - config = json.load(config_file) - post_metadata = next((p for p in config["posts"] if p["file"] == args.post), None) - if not post_metadata: - print("Post not found") - sys.exit(1) - for line in template_file: - if line == "{content}\n": - sys.stdout.flush() - subprocess.call(["markdown"], stdin=post_file, stdout=sys.stdout) - sys.stdout.flush() - elif line == "{header}\n": - sys.stdout.write(""" - <h2>{title}</h2> - <em>{date}</em> - """.format(title=post_metadata["title"], date=post_metadata["date"])) - elif line == "{nav}\n": - shutil.copyfileobj(nav_file, sys.stdout) - else: - sys.stdout.write(line) - -This isn't a python tutorial so I'll be quick. It takes an argument with the -name of the post (not including the extension). It finds the metadata for the -post in the json file, then reads the template line by line looking for -substitution points which is substitutes accordingly. - -The `Tupfile` that runs all of these scripts is: - - : foreach html_src/*.css |> cp %f %o |> html/%B.css - : |> ./html_src/nav_html.py > %o |> html_src/nav.html - : foreach posts/*.md | html_src/nav.html |> ./html_src/post_html.py %B > %o |> html/%B.html - : foreach posts/*.md |> cp %f %o |> gopher/%b - : | html_src/nav.html |> ./html_src/index_html.py > %o |> html/index.html - : |> ./gopher_src/index.py > %o |> gopher/index - -Finally I have a `publish.sh` that runs `tup` and then `rsync` to copy all the -updates to the server. - -The git repo with all this stuff in can be accessed using -`git clone git://shtanton.com/phlog`. - -### Conclusion - -I was pretty pleased with myself once I got this working so thought I'd write -this, but it'll probably improve further. Maybe I'll make this a series. As -always my email is charlie@shtanton.com. diff --git a/gemini/posts/ex.gmi b/gemini/posts/ex.gmi @@ -101,4 +101,4 @@ Most of them just because this whole idea is crazy outlandish. The one that coul ### Conclusion -This is mostly just me playing with ideas. I don't know how this would actually look and feel in a real editor, but I plan on finding out. Maybe there'll be a another post one day with details of a working usable editor, based on ex that I'll have written. Maybe someone else will see these ideas and agree with one or two of them and build something new and impressive. Maybe all my ideas suck and I'm completely dillusional. Either way I'd appreciate you letting me know any thoughts this has provoked via my email, charlie@shtanton.com +This is mostly just me playing with ideas. I don't know how this would actually look and feel in a real editor, but I plan on finding out. Maybe there'll be a another post one day with details of a working usable editor, based on ex that I'll have written. Maybe someone else will see these ideas and agree with one or two of them and build something new and impressive. Maybe all my ideas suck and I'm completely dillusional. Either way I'd appreciate you letting me know any thoughts this has provoked via my email, charlie@shtanton.xyz diff --git a/gemini/posts/index.gmi b/gemini/posts/index.gmi @@ -1,4 +1,4 @@ # Gemlog -=> gemini://shtanton.com/posts/all_the_protocols.gmi All the protocols - 2020-11-17 18:20:28 -=> gemini://shtanton.com/posts/build_process.gmi How this site is built - 2020-08-21 08:51:10 -=> gemini://shtanton.com/posts/ex.gmi Reviving ex in 2020 - 2020-08-05 15:27:08 +=> gemini://shtanton.xyz/posts/best_social_media.gmi The Best Social Media - 2021-04-30 12:29:45 +=> gemini://shtanton.xyz/posts/all_the_protocols.gmi All the protocols - 2020-11-17 18:20:28 +=> gemini://shtanton.xyz/posts/ex.gmi Reviving ex in 2020 - 2020-08-05 15:27:08