Server
I've decided the bump the priority of making a server for this website and hosting it elsewhere, as even though I don't have very much stuff, it is already becoming tedious updating all of the sidenavigation elements for all the pages whenever I add a new one. I know I can put that into a separate HTML file and include it using some JavaScript as shown in this example by W3Schools, but one of my goals is to have this site not use any JavaScript. Also, this is the exact use case of a server, doing some backend stuff that shouldn't need to be done by the client and then serving the result to the client.
I am using Go to make the server as it has a lot of primitives in for networking already and it seems to have a nice environment. Eventually I want to make the server myself, but making the server is not as important to me as being able to easily make and maintain the website, so I'm starting with an existing server.
I am using Echo as the server. So far, this has made it incredibly easy to get up and running. I have two source files, one of which is only used to provide html in the event that the server can't read some html files on disk. The source file which provides all of the backend functionality is 101 lines long and is able to replicate all of the functionality of this neocities site. It also provides a nice 404 Not Found page that still uses the sidenav you see on the pages of the neocities site.
There are still some things to do before I want to shutdown the neocities site, and there are already some things that the server does which neocities cannot. I'll leave a list here with the status as of 29/06/2024, however I can't guarantee I'll update it.
Things the server does that Neocities doesn't
- The main page content is separate from other elements such as the sidenav
- Each element only has one source of truth. For example, the sidenav is written in a single file and applied to all pages
- Unhandled URLs have a 404 Not Found page that matches the other pages (sidenav, formatting, etc.)
- Adding something to all pages can be done simply be creating a single new div in a file
Things that still need work
- The sidenav should be automatically generated based on the file hierarchy of the main pages
- The page title should reflect what page it is
- There should be an icon for the website that appears next to the tab title
- Pages should be written in markdown and converted to HTML
- I may want to introduce templating as some things such as the tab title and the website address would be much easier to do with templates
So far, I have replicated everything that is on this neocities site already. As that's the case, I am going to start looking at hosting now.