3 This script will scan through all pages, chapters books and shelves via the API to generate a sitemap XML file.
5 **This is a very simplistic single-script-file example of using the endpoints API together**
6 , it is not a fully-featured & validated script.
10 You will need php (~7.2+) installed on the machine you want to run this script on.
11 You will also need BookStack API credentials (TOKEN_ID & TOKEN_SECRET) at the ready.
16 # Downloading the script
17 # ALTERNATIVELY: Clone the project from GitHub and run locally.
18 curl https://raw.githubusercontent.com/BookStackApp/api-scripts/main/php-generate-sitemap/generate-sitemap.php > generate-sitemap.php
21 # ALTERNATIVELY: Open the script and edit the variables at the top.
22 export BS_URL=https://bookstack.example.com # Set to be your BookStack base URL
23 export BS_TOKEN_ID=abc123 # Set to be your API token_id
24 export BS_TOKEN_SECRET=123abc # Set to be your API token_secret
27 php generate-sitemap.php <output_file_name>
33 # Create a sitemap called "sitemap.xml within the current directory
34 php generate-sitemap.php ./sitemap.xml