]> BookStack Code Mirror - api-scripts/blob - php-generate-sitemap/readme.md
bd4c77382520ff3528cba800b6773f50f5ff21dc
[api-scripts] / php-generate-sitemap / readme.md
1 # Generate Sitemap
2
3 This script will scan through all pages, chapters books and shelves via the API to generate a sitemap XML file.
4
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. 
7
8 ## Requirements
9
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.
12
13 ## Running
14
15 ```bash
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
19
20 # Setup
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
25
26 # Running the script
27 php generate-sitemap.php <output_file_name>
28 ```
29
30 ## Examples
31
32 ```bash
33 # Create a sitemap called "sitemap.xml within the current directory
34 php generate-sitemap.php ./sitemap.xml
35 ```