Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugoThemesSiteBuilder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-09-06 20:00:15 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-09-06 20:21:19 +0300
commitdfaa658e27a45b2cf27513db6648492be08c9ff5 (patch)
treec2711402ae078296edc2d4b5088606a580f21393
parentbe3a8d991653424b3c0a27f8f28b76eb72c489e8 (diff)
Add expiryDate 2 years after last theme update/version
This should be a clear indication that the theme isn't up to date.
-rw-r--r--README.md6
-rw-r--r--pkg/buildcmd/build.go19
2 files changed, 21 insertions, 4 deletions
diff --git a/README.md b/README.md
index 236dbfa..6c02396 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,12 @@ A collection of themes created by the Hugo community. Builds to [themes.gohugo.i
[![Netlify Status](https://api.netlify.com/api/v1/badges/58968044-3238-424c-b9b6-e0d00733890c/deploy-status)](https://app.netlify.com/sites/hugothemes/deploys)
+
+# Themes are removed if not up to date
+
+The current policy is to expire a theme if not updated (version date) for the last years. Even if your theme is feature complete, it's appreciated that you check on from time to time and verify that it works with never Hugo versions.
+
+
# Adding a theme to the list
Create your theme using <code>hugo new theme <em>THEME_NAME</em></code>. In your theme repository:
diff --git a/pkg/buildcmd/build.go b/pkg/buildcmd/build.go
index a4f6878..e3ba4b2 100644
--- a/pkg/buildcmd/build.go
+++ b/pkg/buildcmd/build.go
@@ -169,8 +169,8 @@ func (c *buildClient) writeThemesContent() error {
}
func (c *buildClient) writeThemeContent(k string, m client.Module) error {
- re := regexp.MustCompile(`\/v\d+$`)
- themeName := strings.ToLower(path.Base(re.ReplaceAllString(k, "")))
+ re := regexp.MustCompile(`\/v\d+$`)
+ themeName := strings.ToLower(path.Base(re.ReplaceAllString(k, "")))
themeDir := filepath.Join(c.contentDir, "themes", themeName)
client.CheckErr(os.MkdirAll(themeDir, 0777))
@@ -311,9 +311,10 @@ func (t *theme) warn(s string) {
t.themeWarnings = append(t.themeWarnings, s)
}
+// 30 days.
+var d30 = 30 * 24 * time.Hour
+
func (t *theme) calculateWeight(maxStars int) {
- // 30 days.
- d30 := 30 * 24 * time.Hour
// Higher is better.
t.weight = maxStars + 500
@@ -368,8 +369,18 @@ func (t *theme) toFrontMatter() map[string]interface{} {
htmlURL = fmt.Sprintf("https://%s", t.m.Path)
}
+ var expiryDate time.Time
+ if !t.m.Time.IsZero() {
+ // 2 years since last version.
+ expiryDate = t.m.Time.Add(24 * d30)
+ } else {
+ // In practice, this will never expire.
+ expiryDate = time.Now().Add(22 * d30)
+ }
+
return map[string]interface{}{
"draft": t.draft,
+ "expiryDate": expiryDate,
"title": title,
"slug": t.name,
"aliases": []string{"/" + t.name},