summaryrefslogtreecommitdiffstats
path: root/htmldoc/buildhtml.sh
blob: 8a41f454fb4fe07464c4e18a28a09e32cd3df87f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

# buildhtml.sh

# Builds the html static site, using mkdocs
# Assumes that the script is executed from the root netdata folder, by calling htmldoc/buildhtml.sh

# Copy all netdata .md files to htmldoc/src. Exclude htmldoc itself and also the directory node_modules generated by Netlify
echo "Copying files"
rm -rf htmldoc/src
find . -type d \( -path ./htmldoc -o -path ./node_modules \) -prune -o -name "*.md" -print | cpio -pd htmldoc/src

# Modify the first line of the main README.md, to enable proper static html generation 
sed -i '0,/# netdata /s//# Introducing NetData\n\n/' htmldoc/src/README.md

echo "Creating mkdocs.yaml"

# Generate mkdocs.yaml
htmldoc/buildyaml.sh > htmldoc/mkdocs.yml

echo "Fixing links"

# Fix links (recursively, all types, executing replacements)
htmldoc/checklinks.sh -rax
if [ $? -eq 1 ] ; then exit 1 ; fi

echo "Calling mkdocs"

# Build html docs
mkdocs build --config-file=htmldoc/mkdocs.yml

echo "Finished"