-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgenerateThemeSite.sh
41 lines (32 loc) · 1.63 KB
/
generateThemeSite.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
#!/bin/bash
# This is the hugo Theme Site Builder
mkdir -p hugoThemeSite
cd hugoThemeSite
#hugo new site themes
git clone https://github.com/spf13/HugoThemesSite.git themeSite
git clone https://github.com/spf13/HugoBasicExample.git exampleSite
cd exampleSite
git clone --recursive https://github.com/spf13/hugoThemes.git themes
cd ..
mkdir -p themeSite/content
mkdir -p themeSite/static/images
for x in `ls -d exampleSite/themes/*/ | cut -d / -f3`; do
echo hugo -s exampleSite -d ../themeSite/static/theme/$x/ -t $x -b http://themes.gohugo.io/theme/$x/
hugo -s exampleSite -d ../themeSite/static/theme/$x/ -t $x -b http://themes.gohugo.io/theme/$x/
echo "+++" > themeSite/content/$x.md
echo "screenshot = \"/images/$x.screenshot.png\"" >> themeSite/content/$x.md
echo "thumbnail = \"/images/$x.tn.png\"" >> themeSite/content/$x.md
echo "demo = \"/theme/$x/\"" >> themeSite/content/$x.md
repo=`git -C exampleSite/themes/$x remote -v | head -n 1 | awk '{print$2}'`
echo "source = \"$repo\"" >> themeSite/content/$x.md
cat exampleSite/themes/$x/theme.toml >> themeSite/content/$x.md
echo "+++\n" >> themeSite/content/$x.md
cat exampleSite/themes/$x/README.md >> themeSite/content/$x.md
cp exampleSite/themes/$x/images/screenshot.png themeSite/static/images/$x.screenshot.png
cp exampleSite/themes/$x/images/tn.png themeSite/static/images/$x.tn.png
done
echo "**********************************************************************\n"
echo "\n"
echo "to view the site locally run 'hugo server -s hugoThemeSite/themeSite'\n"
echo "\n"
echo "**********************************************************************\n"