From 54448f68b0638f6918b16c4120d11e1e03e090b2 Mon Sep 17 00:00:00 2001 From: xing Date: Wed, 29 Mar 2023 21:58:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B6=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/pkg/models/wp_posts.go | 1 + .../theme/twentyfifteen/posts/index.gohtml | 37 ++++++++------- .../theme/twentyseventeen/posts/index.gohtml | 8 +++- internal/theme/wp/index.go | 13 +++++ internal/theme/wp/stickyposts.go | 47 +++++++++++++++++++ 5 files changed, 87 insertions(+), 19 deletions(-) create mode 100644 internal/theme/wp/stickyposts.go diff --git a/internal/pkg/models/wp_posts.go b/internal/pkg/models/wp_posts.go index 10cc88a..bab8aa2 100644 --- a/internal/pkg/models/wp_posts.go +++ b/internal/pkg/models/wp_posts.go @@ -35,6 +35,7 @@ type Posts struct { Tags []string `json:"tags"` CategoriesHtml string TagsHtml string + IsSticky bool Thumbnail PostThumbnail AttachmentMetadata WpAttachmentMetadata } diff --git a/internal/theme/twentyfifteen/posts/index.gohtml b/internal/theme/twentyfifteen/posts/index.gohtml index 7d25ce8..b317b22 100644 --- a/internal/theme/twentyfifteen/posts/index.gohtml +++ b/internal/theme/twentyfifteen/posts/index.gohtml @@ -32,32 +32,35 @@ diff --git a/internal/theme/twentyseventeen/posts/index.gohtml b/internal/theme/twentyseventeen/posts/index.gohtml index 947eb7f..92d98a7 100644 --- a/internal/theme/twentyseventeen/posts/index.gohtml +++ b/internal/theme/twentyseventeen/posts/index.gohtml @@ -17,8 +17,12 @@
{{ range $k,$v:=.posts}} -
- +
+ {{if $v.IsSticky}} + + {{end}}