Scroll to top

29/01/2023


2023/01/29#p1

0 comments: click to leave a comment

Big update for hyblog today: custom page management.

Custom pages can be added, updated, deleted! In /admin there is now a link to 'Manage pages' at the top.

  • 'Add a page' shows a simple form with just 'Title' and 'Content' fields. Pages are saved as .md files in /pages/ – add content in markdown and HTML
  • any existing pages will be listed as links to go to an 'update' page
  • each page listed will have delete icon to the right

A new file, page.php, accepts a URL parameter ?p={page_name}, gets the file contents from the relevant file, and displays the page. The address in the browser history is then changed to a cleaner version using javascript - a page called 'test' will have the link http(s)://{root_url}/test/ rather than http(s)://{root_url}/page.php?p=test.

As the page addresses don't actually exist the new 404 page checks if the URI matches one of the pages and redirects to /page.php?p=test. The footer then checks /pages/ for files and display links for each in the menu tray.

No comments yet
Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



No comments yet
Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



2023/01/29#p3

0 comments: click to leave a comment

Just realised I forgot to add authentication checks to the page management stuff so will need to make a few more changes. I was too keen to get it working and uploaded that I overlooked the necessary security. 🤦‍♂️

No comments yet
Leave a reply



You can also:

Click here to reply using email Reply by email Send a webmention Send a Webmention



Close