forked from ArmDeveloperEcosystem/arm-learning-paths
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hugo-server.sh
executable file
·46 lines (41 loc) · 1.56 KB
/
hugo-server.sh
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
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
# =============================================================================
# Build the hugo site static html pages.
# -----------------------------------------------------------------------------
hugo
# =============================================================================
# Enable the home page search box.
# -----------------------------------------------------------------------------
# Attempt to use the system's pagefind if it is available on PATH or as an alias,
# otherwise default to our own local version of it in order to generate the
# search index data.
# Get ourselves a useable pagefind.
PAGEFIND=pagefind
if ! command $PAGEFIND --version &> /dev/null; then
case "$(uname -s)" in
Darwin*)
PAGEFIND=bin/pagefind.arm64
;;
Linux*)
if [ "$(uname -m)" == "aarch64" ]; then
PAGEFIND=bin/pagefind.aarch64
else
PAGEFIND=bin/pagefind
fi
;;
MINGW*|CYGWIN*|MSYS_NT*)
PAGEFIND=bin/pagefind.exe
;;
*)
echo "No pagefind executable found or known for this platform"
PAGEFIND=""
esac
fi
# If we have a pagefind executable, generate the search index.
if [[ -n "$PAGEFIND" ]]; then
$PAGEFIND --site "public" --output-subdir ../static/pagefind
fi
# =============================================================================
# Serve our local tree for interactive development.
# -----------------------------------------------------------------------------
hugo server