diff options
-rw-r--r-- | content/blog/test1.md | 2 | ||||
-rw-r--r-- | content/blog/test2/index.md | 2 | ||||
-rw-r--r-- | metadata/metadata.yaml | 2 | ||||
-rwxr-xr-x | scripts/build_content.sh | 24 | ||||
-rw-r--r-- | templates/base.html | 18 | ||||
-rw-r--r-- | templates/pageHeaderSm.html | 2 |
6 files changed, 31 insertions, 19 deletions
diff --git a/content/blog/test1.md b/content/blog/test1.md index ec31808..8e2b0b9 100644 --- a/content/blog/test1.md +++ b/content/blog/test1.md | |||
@@ -2,3 +2,5 @@ | |||
2 | date: 2020-12-25 | 2 | date: 2020-12-25 |
3 | title: Test Page 1 | 3 | title: Test Page 1 |
4 | --- | 4 | --- |
5 | |||
6 | # Test Page 1 | ||
diff --git a/content/blog/test2/index.md b/content/blog/test2/index.md index 156909e..c23538b 100644 --- a/content/blog/test2/index.md +++ b/content/blog/test2/index.md | |||
@@ -2,3 +2,5 @@ | |||
2 | date: 2020-12-27 | 2 | date: 2020-12-27 |
3 | title: Test Page 2 | 3 | title: Test Page 2 |
4 | --- | 4 | --- |
5 | |||
6 | # Test Page 2 | ||
diff --git a/metadata/metadata.yaml b/metadata/metadata.yaml index 773f155..eb0f054 100644 --- a/metadata/metadata.yaml +++ b/metadata/metadata.yaml | |||
@@ -4,7 +4,7 @@ site: | |||
4 | 4 | ||
5 | menus: | 5 | menus: |
6 | main: | 6 | main: |
7 | - id: home | 7 | - id: index |
8 | label: Home | 8 | label: Home |
9 | url: / | 9 | url: / |
10 | - id: blog | 10 | - id: blog |
diff --git a/scripts/build_content.sh b/scripts/build_content.sh index 5b4bb85..298291d 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh | |||
@@ -34,9 +34,6 @@ get_section() { | |||
34 | filename=${filename#"$CONTENT_DIR"} | 34 | filename=${filename#"$CONTENT_DIR"} |
35 | filename=${filename%.md} | 35 | filename=${filename%.md} |
36 | filename=$(echo "$filename" | cut -f1 -d /) | 36 | filename=$(echo "$filename" | cut -f1 -d /) |
37 | if [ "$filename" = "index.md" ]; then | ||
38 | filename="home" | ||
39 | fi | ||
40 | echo "$filename" | 37 | echo "$filename" |
41 | } | 38 | } |
42 | 39 | ||
@@ -70,12 +67,12 @@ get_subpages() { | |||
70 | fi | 67 | fi |
71 | 68 | ||
72 | if [ ${#child_pages[@]} -ne 0 ]; then | 69 | if [ ${#child_pages[@]} -ne 0 ]; then |
73 | echo -e "\033[0;90m[////////]\033[0m Child pages:" | 70 | #echo -e "\033[0;90m[////////]\033[0m Child pages:" |
74 | 71 | ||
75 | collected_metadata="[]" | 72 | collected_metadata="[]" |
76 | 73 | ||
77 | for file in "${child_pages[@]}"; do | 74 | for file in "${child_pages[@]}"; do |
78 | echo -e "\033[0;90m[////////]\033[0m - $file" | 75 | #echo -e "\033[0;90m[////////]\033[0m - $file" |
79 | 76 | ||
80 | url_rel=$(target_url_rel "$basedir" "$file") | 77 | url_rel=$(target_url_rel "$basedir" "$file") |
81 | url_abs=$(target_url_abs "$file") | 78 | url_abs=$(target_url_abs "$file") |
@@ -90,9 +87,9 @@ get_subpages() { | |||
90 | collected_metadata=$(echo "$collected_metadata" | jq ". + [ $metadata ]") | 87 | collected_metadata=$(echo "$collected_metadata" | jq ". + [ $metadata ]") |
91 | done | 88 | done |
92 | 89 | ||
93 | collected_metadata=$(echo "$collected_metadata" | jq "sort_by(.date)") | 90 | collected_metadata=$(echo "$collected_metadata" | jq "sort_by(.date) | reverse") |
94 | 91 | ||
95 | echo "$collected_metadata" | 92 | echo "{ \"pages\": $collected_metadata }" | jq . |
96 | fi | 93 | fi |
97 | } | 94 | } |
98 | 95 | ||
@@ -111,23 +108,22 @@ handle () { | |||
111 | is_home=true | 108 | is_home=true |
112 | fi | 109 | fi |
113 | 110 | ||
114 | subpages_meta=$(mktemp) | 111 | subpages_meta_file=$(mktemp) |
115 | |||
116 | # $(get_subpages "$1") > "$subpages_meta" | ||
117 | 112 | ||
118 | get_subpages "$1" | 113 | echo "$(get_subpages "$1")" > "$subpages_meta_file" |
119 | 114 | ||
120 | pandoc "$1" \ | 115 | pandoc "$1" \ |
121 | -f markdown \ | 116 | -f markdown \ |
122 | -t html5 \ | 117 | -t html5 \ |
123 | --template "${TEMPLATES_DIR}base.html" \ | 118 | --template "${TEMPLATES_DIR}base.html" \ |
124 | -o "$target" \ | 119 | -o "$target" \ |
125 | --metadata isHome=$is_home \ | 120 | --metadata "ishome"=$is_home \ |
126 | --metadata section=$section \ | 121 | --metadata section=$section \ |
122 | --metadata "is$section" \ | ||
127 | --metadata-file metadata/metadata.yaml \ | 123 | --metadata-file metadata/metadata.yaml \ |
128 | --metadata-file "$subpages_meta" | 124 | --metadata-file "$subpages_meta_file" |
129 | 125 | ||
130 | rm "$subpages_meta" | 126 | rm "$subpages_meta_file" |
131 | else | 127 | else |
132 | echo -e "\033[0;32m[COPY ]\033[0m $1 -> $target" | 128 | echo -e "\033[0;32m[COPY ]\033[0m $1 -> $target" |
133 | 129 | ||
diff --git a/templates/base.html b/templates/base.html index de584ac..21ea9a4 100644 --- a/templates/base.html +++ b/templates/base.html | |||
@@ -15,7 +15,7 @@ | |||
15 | $if(keywords)$ | 15 | $if(keywords)$ |
16 | <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> | 16 | <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> |
17 | $endif$ | 17 | $endif$ |
18 | <title>$if(isHome)$$else$$title$ – $endif$$site.title$</title> | 18 | <title>$if(ishome)$$else$$title$ – $endif$$site.title$</title> |
19 | <link rel="stylesheet" href="/style.css" /> | 19 | <link rel="stylesheet" href="/style.css" /> |
20 | $if(section)$ | 20 | $if(section)$ |
21 | <style> | 21 | <style> |
@@ -40,17 +40,29 @@ | |||
40 | 40 | ||
41 | <main class="s-page l-container l-container--content l-container--pad-v"> | 41 | <main class="s-page l-container l-container--content l-container--pad-v"> |
42 | <div class="s-page__content"> | 42 | <div class="s-page__content"> |
43 | $if(isHome)$ | 43 | $if(ishome)$ |
44 | <header class="c-page-header u-hidden@sm-down" role="presentation"> | 44 | <header class="c-page-header u-hidden@sm-down" role="presentation"> |
45 | ${pageHeader()} | 45 | ${pageHeader()} |
46 | </header> | 46 | </header> |
47 | $endif$ | 47 | $endif$ |
48 | 48 | ||
49 | $body$ | 49 | $body$ |
50 | |||
51 | $if(isblog)$ | ||
52 | $if(pages)$ | ||
53 | <ul class="c-refs"> | ||
54 | $for(pages)$ | ||
55 | <li class="c-refs__item"> | ||
56 | <a href="$it.url_rel$">$it.date$ - $it.title$</a> | ||
57 | </li> | ||
58 | $endfor$ | ||
59 | </ul> | ||
60 | $endif$ | ||
61 | $endif$ | ||
50 | </div> | 62 | </div> |
51 | </main> | 63 | </main> |
52 | 64 | ||
53 | $if(isHome)$ | 65 | $if(ishome)$ |
54 | <template id="header-sm"> | 66 | <template id="header-sm"> |
55 | ${pageHeaderSm()} | 67 | ${pageHeaderSm()} |
56 | </template> | 68 | </template> |
diff --git a/templates/pageHeaderSm.html b/templates/pageHeaderSm.html index 6092f30..f9e31ce 100644 --- a/templates/pageHeaderSm.html +++ b/templates/pageHeaderSm.html | |||
@@ -4,7 +4,7 @@ | |||
4 | '| .´ ,~'\ ).,__,)/,," ' . ' | | | ' .' | 4 | '| .´ ,~'\ ).,__,)/,," ' . ' | | | ' .' |
5 | |_ `~´ (/\\, (/\\, _' '_ _| ' |_ _' '_ | 5 | |_ `~´ (/\\, (/\\, _' '_ _| ' |_ _' '_ |
6 | --> | 6 | --> |
7 | <pre class="$if(isHome)$u-hidden@sm-up$endif$"> | 7 | <pre class="$if(ishome)$u-hidden@sm-up$endif$"> |
8 | .| <strong> //\__</strong> ' .' | . | ' . ' | 8 | .| <strong> //\__</strong> ' .' | . | ' . ' |
9 | | <strong> _.~-"""-----~`` ,-´</strong> ' ' |' | ' ' | 9 | | <strong> _.~-"""-----~`` ,-´</strong> ' ' |' | ' ' |
10 | '| <strong>.´ ,~'\ ).,__,)/,," </strong> ' . ' | | | ' .' | 10 | '| <strong>.´ ,~'\ ).,__,)/,," </strong> ' . ' | | | ' .' |