mirror of
https://github.com/ivabus/www
synced 2024-11-21 22:15:06 +03:00
#190 package details page path should be /+full_name/
This commit is contained in:
parent
e7ae5f5ed5
commit
b9e3576eb6
5 changed files with 18 additions and 23 deletions
13
.github/build-package-pages.sh
vendored
13
.github/build-package-pages.sh
vendored
|
@ -1,12 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# cmd: $ ./build-package-pages.sh srcJson targetPath
|
# cmd: $ ./build-package-pages.sh srcJson targetPath
|
||||||
# sample: $ .github/build-package-pages.sh src/data/packages.json src/content/packages'
|
# sample: $ .github/build-package-pages.sh src/data/packages.json src/content/'
|
||||||
|
|
||||||
for row in $(jq -r '.[] | @base64' < "$1"); do
|
for row in $(jq -r '.[] | @base64' < "$1"); do
|
||||||
_jq() {
|
_jq() {
|
||||||
echo "${row}" | base64 --decode | jq -r "${1}"
|
echo "${row}" | base64 --decode | jq -r "${1}"
|
||||||
}
|
}
|
||||||
touch "$2"/"$(_jq '.slug')".md
|
full_name=$(_jq '.full_name')
|
||||||
|
|
||||||
|
if [[ "$full_name" == *\/* ]] || [[ "$full_name" == *\\* ]]
|
||||||
|
then
|
||||||
|
mkdir -p "$2/+$full_name"
|
||||||
|
rm -rf "$2/+$full_name"
|
||||||
|
fi
|
||||||
|
touch "$2"/"+$(_jq '.full_name')".md
|
||||||
content="---
|
content="---
|
||||||
type: page
|
type: page
|
||||||
title: \"$(_jq '.name')\"
|
title: \"$(_jq '.name')\"
|
||||||
|
@ -14,5 +21,5 @@ maintainer: \"$(_jq '.maintainer')\"
|
||||||
Description: \"$(_jq '.desc' | tr '\"' "'")\"
|
Description: \"$(_jq '.desc' | tr '\"' "'")\"
|
||||||
layout: \"package-detail\"
|
layout: \"package-detail\"
|
||||||
---"
|
---"
|
||||||
echo "$content" > "$2"/"$(_jq '.slug')".md
|
echo "$content" > "$2"/"+$(_jq '.full_name')".md
|
||||||
done
|
done
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -27,4 +27,6 @@ cdk.out
|
||||||
|
|
||||||
# initially committed _sample.md only the rest will be ignored
|
# initially committed _sample.md only the rest will be ignored
|
||||||
src/content/packages/*
|
src/content/packages/*
|
||||||
src/static/Images/packages/*
|
src/static/Images/packages/*
|
||||||
|
|
||||||
|
src/content/+*
|
|
@ -29,10 +29,11 @@ The detail pages of each package are not committed to the repository for the
|
||||||
simple reason of that would be too much repeating data.
|
simple reason of that would be too much repeating data.
|
||||||
Execute the following command just once per version of
|
Execute the following command just once per version of
|
||||||
`/src/data/packages.json`. This will create the package detail pages in
|
`/src/data/packages.json`. This will create the package detail pages in
|
||||||
`/src/content/packages/[package_slug].md`.
|
`/src/content/+[package.full_name].md`.
|
||||||
|
Which resembles the installation tag in tea cli
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
.github/build-package-pages.sh src/data/packages.json src/content/packages
|
.github/build-package-pages.sh src/data/packages.json src/content
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<!--
|
|
||||||
this page will be automatically duplicated/populated
|
|
||||||
by .github/build-package-pages.sh
|
|
||||||
before build & deploy probably in Github Actions
|
|
||||||
values to be replaced are title and Description
|
|
||||||
|
|
||||||
WARN: anything else added to this folder will be git ignored
|
|
||||||
-->
|
|
||||||
---
|
|
||||||
type: page
|
|
||||||
title: "mpdecimal"
|
|
||||||
Description: "mpdecimal"
|
|
||||||
layout: "package-detail"
|
|
||||||
---
|
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
<span class="package-install-no">>{{- .installs -}} installs</span> -->
|
<span class="package-install-no">>{{- .installs -}} installs</span> -->
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="/packages/{{- .slug -}}/">
|
<a href="/+{{- .full_name -}}/">
|
||||||
{{- partial "detail-btn.html" . -}}
|
{{- partial "detail-btn.html" . -}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body thumbnail-body-mobile">
|
<div class="card-body thumbnail-body-mobile">
|
||||||
<a href="/packages/{{- .slug -}}/">
|
<a href="/+{{- .full_name -}}/">
|
||||||
<button class="detail-btn-mobile"><i class="icon-enter-arrow"></i>details</button>
|
<button class="detail-btn-mobile"><i class="icon-enter-arrow"></i>details</button>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue