03/12/2020

The archive contains older posts which may no longer reflect my current views.

# I stayed up way too late but think I've got everything sorted for better handling section links should I insert new pieces or even re-order them.

It's meant rebuilding the homepage and constructing the post manually using the post sections rather than using the loop and the_content(). Similar changes had to be made to the live and daily RSS feeds so that they all matched.

The process is as follows:

  • get the full post content and split it at section markers
  • get the latest section number for today from the database
  • check if each section exists in the database: if no, write entry and assign next sequential section number
  • sanitise the section content and add section link based on database entry
  • build the page/feed by combining sections

Because the sections are handled in the order they appear in the post rather than numerically they should always be handled correctly. This means they could be in any order (1,2,5,4,3) but will still have the correct links.

Well, that's the theory.

# Not quite there yet I need to rebuild the single content template along the same lines as that is still working on the old system.

# The single content template has been reworked so all should be good. Now that everything is worked out it's easy to transfer the new style to other pages. Unfortunately, it behaves slightly different in different places or I would be able to just have one file with the new code and include it elsewhere but it's not completely reusable in that sense.

# Truth:

"Blogging is what happens to your writing when you're trying to go in a straight line." Ann Althouse