Merge pull request #216 from teaxyz/lowercased-pages

#215 lowercase all package links
This commit is contained in:
Neil 2022-12-08 07:53:35 +08:00 committed by GitHub
commit 0dfbfc6b21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -6,14 +6,16 @@ for row in $(jq -r '.[] | @base64' < "$1"); do
_jq() {
echo "${row}" | base64 --decode | jq -r "${1}"
}
full_name=$(_jq '.full_name')
full_name=$(_jq '.full_name' | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/')
if [[ "$full_name" == *\/* ]] || [[ "$full_name" == *\\* ]]
then
mkdir -p "$2/+$full_name"
# remove last folder
rm -rf "$2/+$full_name"
fi
touch "$2"/"+$(_jq '.full_name')".md
touch "$2"/"+$full_name".md
content="---
type: page
title: \"$(_jq '.name')\"
@ -21,5 +23,5 @@ maintainer: \"$(_jq '.maintainer')\"
Description: \"$(_jq '.desc' | tr '\"' "'")\"
layout: \"package-detail\"
---"
echo "$content" > "$2"/"+$(_jq '.full_name')".md
echo "$content" > "$2"/"+$full_name".md
done

View file

@ -19,12 +19,12 @@
<span class="package-install-no">>{{- .installs -}}&nbsp;installs</span> -->
</p>
</div>
<a href="/+{{- .full_name -}}/">
<a href="/+{{- lower .full_name -}}/">
{{- partial "detail-btn.html" . -}}
</a>
</div>
<div class="card-body thumbnail-body-mobile">
<a href="/+{{- .full_name -}}/">
<a href="/+{{- lower .full_name -}}/">
<button class="detail-btn-mobile"><i class="icon-enter-arrow"></i>details</button>
</a>
</div>