Skip to content

Commit ec7a1b3

Browse files
authored
feat: enhance-github-pages (#23)
Introducing lib collection.
2 parents 348a734 + ad64578 commit ec7a1b3

7 files changed

Lines changed: 77 additions & 3 deletions

File tree

bin/docs.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,17 @@ readonly MY_PATH
2323
readonly SCRIPT_DIR
2424
readonly DOC_SINGLE="${SCRIPT_DIR}/doc-single.sh"
2525
readonly LIB_BASH_DIR="${SCRIPT_DIR}/.."
26-
readonly LIB_DOCS_DIR="${SCRIPT_DIR}/../docs/lib"
26+
readonly LIB_DOCS_DIR="${SCRIPT_DIR}/../docs/_lib"
27+
28+
function front_matter() {
29+
local title="${1?Must provide title}"
30+
cat <<EOF
31+
---
32+
title: "${title} – lib-bash"
33+
permalink: /lib/${title}/
34+
---
35+
EOF
36+
}
2737

2838
function main() {
2939
rm -rf "${LIB_DOCS_DIR}"
@@ -34,8 +44,10 @@ function main() {
3444
for lib in "${LIB_BASH_DIR}"/lib_*.sh; do
3545
local lib_name
3646
lib_name="$(basename "${lib}")"
37-
local target="${LIB_DOCS_DIR}/${lib_name%.sh}.md"
38-
"${DOC_SINGLE}" "${lib}" >"${target}"
47+
lib_title="${lib_name%.sh}"
48+
local target="${LIB_DOCS_DIR}/${lib_title}.md"
49+
front_matter "${lib_title}" >"${target}"
50+
"${DOC_SINGLE}" "${lib}" >>"${target}"
3951
done
4052
}
4153

docs/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@
33
![Lib-Bash Decorative Image](img/LibBashGitHubSocialPreview.jpg)
44

55
A set of libraries to use from within your Bash scripts.
6+
7+
## Libraries
8+
9+
{% for lib in site.lib %}
10+
11+
- [{{ lib.title }}]({{ lib.url | relative_url }})
12+
13+
{% endfor %}

docs/_config.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# _config.yml
2+
title: lib-bash – Bash Libraries
3+
description: Documentation generated via Jekyll GitHub Action
4+
theme: jekyll-theme-minimal
5+
6+
# Other configurations
7+
markdown: kramdown
8+
strict_front_matter: true
9+
collections:
10+
lib:
11+
output: true
12+
sort_by: title
13+
permalink: /:collection/:path/
14+
#plugins:
15+
# - jekyll-feed
16+
# - jekyll-seo-tag
17+
# - jekyll-sitemap
18+
# - jekyll-remote-theme
19+
# - jekyll-redirect-from
20+
# - jekyll-paginate
21+
# - jekyll-archives
22+
# - jekyll-github-metadata
23+
# - jekyll-avatar
24+
# - jekyll-mentions
25+
# - jekyll-include-cache
26+
# - jekyll-default-layout
27+
# - jekyll-default-mimetype
28+
# - jekyll-optional-front-matter
29+
# - jekyll-readme-index
30+
# - jekyll-relative-links
31+
# - jekyll-remote-theme
32+
# - jekyll-titles-from-headings
33+
# - jekyll-redirect-from
34+
# - jekyll-optional-front-matter
35+
# - jekyll-remote-theme
36+
# - jekyll-titles-from-headings
37+
# - jekyll-redirect-from
38+
#
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "lib_console – lib-bash"
3+
permalink: /lib/lib_console/
4+
---
15

26
# lib_console.sh
37

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "lib_gnucompat – lib-bash"
3+
permalink: /lib/lib_gnucompat/
4+
---
15

26
# GNU-Tools Compatibility Layer
37

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "lib_init – lib-bash"
3+
permalink: /lib/lib_init/
4+
---
15

26
# lib_init.sh
37

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
title: "lib_scriptinfo – lib-bash"
3+
permalink: /lib/lib_scriptinfo/
4+
---
15

26
# lib_scriptinfo.sh
37

0 commit comments

Comments
 (0)