version 0.1.0 - 9/27/2024
This utility will convert a Post to a Page in Publii 0.46.x
I created this utility to aid in quickly converting posts from Publii before 0.46.x that were used as pages into actual pages in Publii 0.46.x or later. The utility is written in Python 3.x. It is a GUI application using the TKinter library (as ugly as that is). I have created an executable for the windows environment that can be downloaded here. On the MacOS or Linux operating system execute the tool using it as a Python script.
Using the scripts on other operating systems (MacOS or Linux) requires a local copy of Python 3 (usually installed).
- Download repository to obtain the source files.
- Make sure they are both in the same folder.
- Launch the program by opening a terminal prompt, navigating to that folder and issuing the commmand:
python ./main.py
Warning I have not tested this script on the MacOS or Linux OS, as I do not have access to these. I expect that things will work, bu there is certainly a possiblity they will not.
Always backup your site before converting posts to pages.
- Open the application on your system (or execute it as a Python script from the command prompt).
- click "Select site" and navigate to where your Publii folder stores sites (usually c:/users/User_Dir/Publii/sites). Select the top-level folder for a site (shown below).
- The utility will run several checks to make sure your site is ready to convert posts to pages. First it will connect to the SQLite database which confirms that the folder does is indeed a Publii site. Next it checks to see what your current theme is. Next it checks the theme's config.json file to make sure it supports PAGES. Finally it checks to see if there are one or more posts that are in Published or Draft status and are not already a page. The figure below shows the tool trying to access a site with a current theme that does not support Pages.
- Once all the checks succeed the tool will list all posts that are not alredy pages. Select the one you want to convert to a page.
- The post details will be displayed and a button to convert it to a page will be added to the interface as shown below.
- Click the button "Convert to Page" to begin the process. You will be asked if you are sure.
- Confirm that you are sure and the page will be converted.
###Warning:
If you are converting a post from a version of Publii before 0.46 that is acting as the homepage for your site (as shown below) open Publii and set this setting (Theme -> Custom Settings -> Layout -> Homepage display) back to "Latest Posts".
After converting that post to a Page set it to your new homepage (as shown below) in Site Settings -> Advanced Options -> SEO -> Homepage.
WARNING: It is not required to close Publii when converting posts to pages but I highly recommend it.
Always backup your site before converting posts to pages.
The author assumes no responsibility for issues, problems, lost data, etc for using this tool. Backup you site first!
Licensed MIT.