Why am I making a new django-driven blog?
I really like the idea of writing in markdown
I want to store my markdown files in a directory structure separate from the moving parts of the website.
Often the files are located in separate directories in a structure like hugo, but up to now they were in the same big git repository. This helps me accomplish my next aim:
I want to manage changes to my website content asynchronously from the changes to the website’s look, feel, and functionality.
I need more functionality that a static site generator can accommodate
How do I have to hack Django to make it work?
URL handling. My current site structure is more semantic than a typical django website. How do I mean? Even though most pages under the hood of my current website are driven by markdown files, the file structure output by Hugo is derived by each file’s location in a directory / file tree on my computer. This makes organizing your site trivial, because you just have to rearrange the files in their folders to generate a new website structure.
However, in a Django site, it seems that a lot of query logic is often built into the django url logic associated with a specific app, rather than by a nested set of directory paths.
Thus a post that might be found in my old site might be: https://danaukes.com/notebook/ubuntu/installation-instructions/, it seems django would be more likely to support https://danaukes.com/blog?/tag=notebook&slug=installation-instructions. I know this is not a perfect comparison between path handlign in the two platforms, but it suffices to illustrate that they are, by default, different. Django is quite flexible in its url handling, so I would like to, for the time being, keep my current urls the way they are.
Another small thing about hugo is that, because it assumes a file structure-driven organization strategy, it permits mixing of lists and posts. A list would typically be a webpage that lists all the posts beneath a given directory in the underlying file structure, while a post is associated with a file in that directory structure.
Django makes no such assumptions, and it’s url mapping, while powerful, can get complicated rather quickly if you’re trying to logic-out which kind of page to serve simply by the URL. In my case, I need to know if a page exists before I choose to serve something in a page format. If a path exists, and has pages under it, I need to show a formatted list of those posts. And if neither a path nor a file exists, I should return an error. I discuss some of the logic I implemented in the views and urls page later, but you get the drift – it’s not as easy as using Django’s out of the box functionality.