Skip to content

Commit

Permalink
Feat: 支持按分组设置文章分类和合集
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Oct 2, 2024
1 parent b594a39 commit 0267864
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ disableThemeInject = false
onlyPublic = true
# Default categories and collections
categories = ["README"]
collections = ["Components"]
collections = []
# Ignore repos in the ignore list
ignoreList = [
"hugo-fixit/.tools",
Expand Down
2 changes: 1 addition & 1 deletion config/development/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# Content adapters config for component projects
# https://github.com/hugo-fixit/component-projects
[projectsAdapters]
enable = false
# enable = false
8 changes: 5 additions & 3 deletions content/en/components/_content.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@
"link" $repoInfo.owner.html_url
"avatar" $repoInfo.owner.avatar_url
-}}
{{- $categories := $group.categories | default $projectsAdapters.categories -}}
{{- $collections := $group.collections | default $projectsAdapters.collections -}}
{{- $params := dict
"fromAdapters" "projects"
"author" $author
"categories" $projectsAdapters.categories
"collections" $projectsAdapters.collections
"categories" $categories
"collections" $collections
"tags" $repoInfo.topics
"lightgallery" true
"capitalizeTitles" false
Expand All @@ -78,7 +80,7 @@
{{- /* Convert relative links to absolute links in the README content */ -}}
{{- $replacement := printf "$1[$2](%v$4)" (printf "https://raw.githubusercontent.com/%v/refs/heads/%v/$3" $repoInfo.full_name $repoInfo.default_branch) -}}
{{- /* Oops! Lookahead regular lookup is not supported in Golang, e.g `(?!http)` */ -}}
{{- $markdown = replaceRE `([!]?)\[(.*?)\]\((/.*).*?(\s+".*?")?\)` $replacement $markdown -}}
{{- $markdown = replaceRE `([!]?)\[(.*?)\]\(([/|\./].*).*?(\s+".*?")?\)` $replacement $markdown -}}
{{- $content := dict
"mediaType" "text/markdown"
"value" $markdown
Expand Down
3 changes: 3 additions & 0 deletions content/zh-cn/collections/tp-components/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: 第三方组件
---
8 changes: 5 additions & 3 deletions content/zh-cn/components/_content.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@
"link" $repoInfo.owner.html_url
"avatar" $repoInfo.owner.avatar_url
-}}
{{- $categories := $group.categories | default $projectsAdapters.categories -}}
{{- $collections := $group.collections | default $projectsAdapters.collections -}}
{{- $params := dict
"fromAdapters" "projects"
"author" $author
"categories" $projectsAdapters.categories
"collections" $projectsAdapters.collections
"categories" $categories
"collections" $collections
"tags" $repoInfo.topics
"lightgallery" true
"capitalizeTitles" false
Expand All @@ -78,7 +80,7 @@
{{- /* Convert relative links to absolute links in the README content */ -}}
{{- $replacement := printf "$1[$2](%v$4)" (printf "https://raw.githubusercontent.com/%v/refs/heads/%v/$3" $repoInfo.full_name $repoInfo.default_branch) -}}
{{- /* Oops! Lookahead regular lookup is not supported in Golang, e.g `(?!http)` */ -}}
{{- $markdown = replaceRE `([!]?)\[(.*?)\]\((/.*).*?(\s+".*?")?\)` $replacement $markdown -}}
{{- $markdown = replaceRE `([!]?)\[(.*?)\]\(([/|\./].*).*?(\s+".*?")?\)` $replacement $markdown -}}
{{- $content := dict
"mediaType" "text/markdown"
"value" $markdown
Expand Down
10 changes: 9 additions & 1 deletion data/projects.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@
- hugo-fixit/FixIt
- hugo-fixit/docs
- title: 🧩 Shortcodes components
collections:
- Components
repos:
- hugo-fixit/component-projects
- hugo-fixit/shortcode-caniuse
- hugo-fixit/shortcode-docs-bookmark
- hugo-fixit/shortcode-mmt-netease
- hugo-fixit/shortcode-rewards
- title: 🧩 Layout components
collections:
- Components
repos:
- hugo-fixit/component-projects
- hugo-fixit/hugo-atom-feed
- hugo-fixit/hugo-json-feed
- title: 🛠️ Tools
categories:
- FixIt Tools
repos:
- hugo-fixit/component-skeleton
- hugo-fixit/fixit-cli
Expand All @@ -23,6 +29,8 @@
- hugo-fixit/.tools
- title: 👾 Third party
description: "Welcome to contribute [PR :(fa-solid fa-code-branch fa-fw):](https://github.com/hugo-fixit/docs/edit/dev/data/projects.en.yml) your theme components."
contentAdapters: false
contentAdapters: true
collections:
- TP Components
repos:
- fixit-theme/hugo-shortcode-plugins-live2d
10 changes: 9 additions & 1 deletion data/projects.zh-cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@
- hugo-fixit/FixIt
- hugo-fixit/docs
- title: 🧩 Shortcodes 组件
collections:
- Components
repos:
- hugo-fixit/component-projects
- hugo-fixit/shortcode-caniuse
- hugo-fixit/shortcode-docs-bookmark
- hugo-fixit/shortcode-mmt-netease
- hugo-fixit/shortcode-rewards
- title: 🧩 布局组件
collections:
- Components
repos:
- hugo-fixit/component-projects
- hugo-fixit/hugo-atom-feed
- hugo-fixit/hugo-json-feed
- title: 🛠️ 工具
categories:
- FixIt Tools
repos:
- hugo-fixit/component-skeleton
- hugo-fixit/fixit-cli
Expand All @@ -23,6 +29,8 @@
- hugo-fixit/.tools
- title: 👾 第三方
description: "欢迎大家投稿 [PR :(fa-solid fa-code-branch fa-fw):](https://github.com/hugo-fixit/docs/edit/dev/data/projects.zh-cn.yml) 你开发的主题组件。"
contentAdapters: false
contentAdapters: true
collections:
- TP Components
repos:
- fixit-theme/hugo-shortcode-plugins-live2d
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/hugo-fixit/docs
go 1.20

require (
github.com/hugo-fixit/FixIt v0.3.13-0.20241001175419-9c440df3d081 // indirect
github.com/hugo-fixit/component-projects v1.2.2 // indirect
github.com/hugo-fixit/FixIt v0.3.13-0.20241002050721-b66fd37057b0 // indirect
github.com/hugo-fixit/component-projects v1.2.3 // indirect
github.com/hugo-fixit/shortcode-caniuse v1.1.3 // indirect
github.com/hugo-fixit/shortcode-rewards v1.0.4 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/hugo-fixit/FixIt v0.3.13-0.20241001175419-9c440df3d081 h1:6DHB2n0WzNe+wa8ZbnS0aUb2+C5MS2ZKzJPKjDjYIAc=
github.com/hugo-fixit/FixIt v0.3.13-0.20241001175419-9c440df3d081/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/component-projects v1.2.2 h1:s6Mm48B3N/qiM2mxLFeRKlrMSzK3mWh7Fw0r+8Q+a04=
github.com/hugo-fixit/component-projects v1.2.2/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c=
github.com/hugo-fixit/FixIt v0.3.13-0.20241002050721-b66fd37057b0 h1:uCuobPoHymt89+jPxE5XKuINMebjeegjGHnW0MzFbmw=
github.com/hugo-fixit/FixIt v0.3.13-0.20241002050721-b66fd37057b0/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/component-projects v1.2.3 h1:HUf25WKyP2ORruOwiuvmMD9Z098LVQOqm9OGszYOTGo=
github.com/hugo-fixit/component-projects v1.2.3/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c=
github.com/hugo-fixit/shortcode-caniuse v1.1.3 h1:U1YBJz5SI/d1BBQhHcD0eVgJdCcpzK2usSizPiu+a4w=
github.com/hugo-fixit/shortcode-caniuse v1.1.3/go.mod h1:RoPLFt+7uLui5rjvkC/qFGeo4nly5AzzwIID9SoDKNc=
github.com/hugo-fixit/shortcode-rewards v1.0.4 h1:62qCmcGvAJf+qa+8ofRX6jwMUXo6Q4+PQvlOtu0ZGBA=
Expand Down

0 comments on commit 0267864

Please sign in to comment.