Creating My Site
October 2, 2022•621 words
created_at: 2021-08-27
I bought my first domain through Google Domains and actually hosted my site through Google's website builder. It really is a great free builder with solid SEO, but I'm a programmer, so I wanted to program.
Distributed networks are an amazing technology, and I was drawn to IPFS hosting. I used Pinata to pin my new site, but when I tried using an HTTP request for a different page, it failed. Instead of fetching pages dynamically, I created a site that downloaded every page on load. This was not scalable. The method I ended up using for posts was incredibly simple, though. All I needed to do was create a javascript file and import it into script.js
.
While still hosting on IPFS, I connected my GitHub repo to Pinata and enjoyed automatic deployment; however, this was nearing my interest in Go. I saw how effective Go was for serving, so I decided to take my site off the IPFS network and deploy with Go.
Now that I had a house-hold server hosting my website, I could begin to move toward a scalable design. Slowly but surely, I converted all posts to pure .md files and handled GET
requests from the server. At that point I had a fully functioning Go server, but I wasn't finished yet.
I moved from splch.dev to splch.net and finally settled with slc.is. After learning more about TLDs, I realized I wouldn't want to have a country with lax laws ultimately control my website. After searching for countries with the strongest privacy laws, I settled with Iceland's .is
TLD. With this strong domain name, I ventured forward in refining the website.
Having to create new markdown files on the server was tedious and the website was created to simplify content creation. With a server, I could finally create posts from the website! I made it so I could click on the Splch logo and a markdown editor would appear (I'm using that very editor to write this post). With a simple POST
request, I verify and write the submitted post to a markdown file. In addition, the server returns markdown posts from a folder, so all that was required was to save the new markdown file in that posts/
folder and it would populate in the website.
I'm sure more will come with the site, but having a built-in editor makes creating posts like these a breeze. To make the experience nicer, I started using EasyMDE to create and edit posts, and Marked to render the markdown to HTML. Then, DOMPurify sanitizes the HTML before populating. I also implemented KaTex for math and highlight.js for code appearances:
def main():
msg = "Hadamard Gate ="
print(msg)
if __name__ == "__main__":
main()
$$
\frac{1}{\sqrt{2}}
\begin{bmatrix}
1 & 1 \
1 & -1
\end{bmatrix}
$$
It's fun to have this framework for posting — I'm having a more positive experience using CDNs to host the external libraries. Not having to worry about updating libraries I'm using is relaxing as I can focus on improving my own scripts and posts. Clearly, I'm excited about this website and hope to share it with more people! I want to make this code open-source and create a helpful template site; however, I'll first need to improve the code a bit. But I'm very happy to say that the major work is done and the functionality is here! 🥳
Edit (9/6/2021) — I removed EasyMDE to decrease load times. I also render code with a Replit IFrame. The site is now open-source! Check out this post to see the server running or this repo for the code! 🤩