home comics writing pictures archive about

2018-03-04 - The easier road

I'm currently working on converting the writings section into a hierarchy of pages instead of the simple category-page system it has now. This allows me the freedom to have as many or a few levels as I need instead of trying to force all pages into a fixed arrangement. One of the main requirements for the new version is that it should support using Open Live Writer, the program I use to write blog posts, to create and edit pages. That way I have a consistent and simple way to maintain the content on the site which should encourage me to write more.

I started down the road of duplicating the interface I had for the blog into the writing section. The plan was to use the title as the path to the page. For example I would have a page with a title of "Programming/Languages/C++" where "C++" would be the actual title of the page and "Languages" and "Programming" would be the titles of parent pages. The API would split the title into parts based on slashes and use that to identify the page being created, edited or deleted. There would also have been logic to create any missing pages in the path and delete any pages that were empty as a result of the changes. That is until I discovered an easier road.

While looking into what information Open Live Writer encodes in a post when sending it to the website I found mentions of "Supports pages" and "Supports parent" options. Pages and parents? That's exactly what I'm trying to implement. After some investigation I discovered that Open Live Writer had a second editor mode for dealing with a hierarchies of pages. All I had to do was tell it that my website supported Pages and it would enable that functionality for me.

I was very happy to find this because it made things a lot simpler. Instead of abusing the title to give more information that it was intended to give I could get that information from places specifically decided to contain that information. On the other hand I was also slightly saddened to find this. I had spent a lot of time planning out how to handle the title as a path and had already started writing code for some of the methods. Now I had to throw all of that away.

The easier road is nice but sometimes it's annoying when you don't notice it until after you've been walking down the hard road for a while.

Comments: