️ feat: add post fetching by ID and improve blog home page

- Implemented `getPostById` API function to fetch a post by its ID.
- Refactored the main page to use a new `BlogHome` component for better organization.
- Added loading state and sorting functionality for posts on the blog home page.
- Integrated label fetching and display on the blog home page.
- Enhanced the blog card component with improved layout and statistics display.
- Updated the navbar to use dynamic configuration values.
- Added Docker support with a comprehensive build and push workflow.
- Created a custom hook `useStoredState` for managing local storage state.
- Added a new page for displaying individual posts with metadata generation.
- Removed unused components and files to streamline the codebase.
This commit is contained in:
2025-07-25 03:58:53 +08:00
parent abe1099711
commit 5fac42439a
24 changed files with 752 additions and 338 deletions

View File

@ -32,12 +32,13 @@ const (
OrderedByLikeCount = "like_count" // 按点赞数排序
OrderedByCommentCount = "comment_count" // 按评论数排序
OrderedByViewCount = "view_count" // 按浏览量排序
HeatFactorViewWeight = 1 // 热度因子:浏览量权重
HeatFactorLikeWeight = 5 // 热度因子:点赞权重
HeatFactorCommentWeight = 10 // 热度因子:评论权重
OrderedByHeat = "heat"
HeatFactorViewWeight = 1 // 热度因子:浏览量权重
HeatFactorLikeWeight = 5 // 热度因子:点赞权重
HeatFactorCommentWeight = 10 // 热度因子:评论权重
)
var (
OrderedByEnumPost = []string{OrderedByCreatedAt, OrderedByUpdatedAt, OrderedByLikeCount, OrderedByCommentCount, OrderedByViewCount} // 帖子可用的排序方式
OrderedByEnumPost = []string{OrderedByCreatedAt, OrderedByUpdatedAt, OrderedByLikeCount, OrderedByCommentCount, OrderedByViewCount, OrderedByHeat} // 帖子可用的排序方式
)