diff --git a/config.yaml b/config.yaml index d4b1251..15f1a97 100644 --- a/config.yaml +++ b/config.yaml @@ -54,6 +54,9 @@ site: - name: Archive icon: fa-solid fa-box-archive url: /archive + - name: Friends + icon: fa-solid fa-user-group + url: /friend - name: About icon: fa-solid fa-circle-info url: /about @@ -71,20 +74,29 @@ site: number: 10 archive: title: Archive - number: 10 + number: 15 search: title: Search - number: 10 + number: 15 category: title: Category - number: 10 + number: 15 tag: title: Tag - number: 10 + number: 15 # about config about: - title: About me + title: About src: _blog/src/about dst: _blog/dst/about - filename: index \ No newline at end of file + filename: index + + # friends link + friend: + title: Friends + list: + - name: + link: + avatar: + description: \ No newline at end of file diff --git a/config/mFriend.go b/config/mFriend.go new file mode 100644 index 0000000..663bf1f --- /dev/null +++ b/config/mFriend.go @@ -0,0 +1,13 @@ +package config + +type mFriend struct { + Title string `json:"title"` + List []mFriendItem `json:"list"` +} + +type mFriendItem struct { + Name string `yaml:"name"` + Link string `yaml:"link"` + Avatar string `yaml:"avatar"` + Description string `yaml:"description"` +} diff --git a/config/mSite.go b/config/mSite.go index 73a19a7..c7a3833 100644 --- a/config/mSite.go +++ b/config/mSite.go @@ -1,8 +1,9 @@ package config type mSite struct { - Info mInfo `yaml:"info"` - Menu mMenu `yaml:"menu"` - Post mPost `yaml:"post"` - About mAbout `yaml:"about"` + Info mInfo `yaml:"info"` + Menu mMenu `yaml:"menu"` + Post mPost `yaml:"post"` + About mAbout `yaml:"about"` + Friend mFriend `yaml:"friend"` } diff --git a/internal/mApp/mHandler.go b/internal/mApp/mHandler.go index 40b1227..3cd0bad 100644 --- a/internal/mApp/mHandler.go +++ b/internal/mApp/mHandler.go @@ -496,3 +496,21 @@ func (ma *MApp) RSSHandler(ctx *gin.Context) { ctx.String(http.StatusNotFound, "RSS Not Found") } } + +func (ma *MApp) FriendHandler(ctx *gin.Context) { + resData := gin.H{ + "site_info": gin.H{ + "logo": ma.Config.MSite.Info.Logo, + "title": ma.Config.MSite.Info.Title, + "author": ma.Config.MSite.Info.Author, + "language": ma.Config.MSite.Info.Language, + "copyright": template.HTML(ma.Config.MSite.Info.Copyright), + }, + "menu": ma.Config.MSite.Menu, + "friend": gin.H{ + "title": ma.Config.MSite.Friend.Title, + "list": ma.Config.MSite.Friend.List, + }, + } + ctx.HTML(http.StatusOK, "friend.html", resData) +} diff --git a/internal/mApp/mRouter.go b/internal/mApp/mRouter.go index 06e2204..518a7ef 100644 --- a/internal/mApp/mRouter.go +++ b/internal/mApp/mRouter.go @@ -7,6 +7,7 @@ func (ma *MApp) loadRoutes() { ma.engine.GET("/rss", ma.RSSHandler) ma.engine.GET("/about", ma.AboutHandler) ma.engine.GET("/search", ma.SearchHandler) + ma.engine.GET("/friend", ma.FriendHandler) ma.engine.GET("/archive", ma.ArchiveHandler) ma.engine.GET("/post/:hash", ma.PostHandler) ma.engine.GET("/tag/:hash", ma.TagHandler) diff --git a/templates/default/assets/css/about.css b/templates/default/assets/css/about.css index ef5ed68..a3db12a 100644 --- a/templates/default/assets/css/about.css +++ b/templates/default/assets/css/about.css @@ -16,9 +16,10 @@ tr, th, td { color: var(--primary-text-color); } - -.about-title-wrap { - text-align: center; +.root-container { + max-width: 1000px; + margin-left: auto; + margin-right: auto; } .about-title { @@ -27,7 +28,6 @@ tr, th, td { .about-content { line-height: 1.6; - max-width: 1000px; color: var(--primary-text-color); } diff --git a/templates/default/assets/css/friend.css b/templates/default/assets/css/friend.css new file mode 100644 index 0000000..b7a5af7 --- /dev/null +++ b/templates/default/assets/css/friend.css @@ -0,0 +1,43 @@ +.friend-title { + color: var(--primary-color); +} + +.friend-item { + margin-top: 20px; + padding: 10px; + display: flex; + align-items: center; + color: var(--primary-text-color); + border: var(--secondary-text-color) 1px dashed; + border-radius: 4px; +} + +.friend-item:hover { + cursor: pointer; + border: var(--primary-color) 1px solid; +} + +.friend-avatar { + width: 64px; + height: 64px; + object-fit: cover; + border-radius: 50%; +} + +.friend-info-wrap { + padding-left: 10px; +} + +.friend-name { + font-size: 18px; + font-weight: bolder; +} + +.friend-description { + width: 200px; + font-size: 14px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + color: var(--secondary-text-color); +} \ No newline at end of file diff --git a/templates/default/assets/css/tag.css b/templates/default/assets/css/tag.css index e527597..5843956 100644 --- a/templates/default/assets/css/tag.css +++ b/templates/default/assets/css/tag.css @@ -40,8 +40,8 @@ width: 100%; height: 100%; opacity: 0.4; - mask-image: radial-gradient(at 100% 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%); - -webkit-mask-image: radial-gradient(at 100% 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%); + mask-image: radial-gradient(at 100% 100%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%); + -webkit-mask-image: radial-gradient(at 100% 100%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%); } .tag-word-cloud-canvas * { diff --git a/templates/default/assets/js/index.js b/templates/default/assets/js/index.js index 2592c2b..7748f26 100644 --- a/templates/default/assets/js/index.js +++ b/templates/default/assets/js/index.js @@ -1,25 +1,4 @@ function search() { const keyword = document.getElementById("index-search-input").value; window.location.href = "/search?keyword=" + keyword; -} - -function typeWriter(element_id, text) { - const element = document.getElementById(element_id); - let i = 0; - - element.innerHTML = ''; - function type() { - if (i < text.length) { - const minSpeed = 50; - const maxSpeed = 200; - const randomSpeed = Math.floor(Math.random() * (maxSpeed - minSpeed + 1)) + minSpeed; - - element.innerHTML += text.charAt(i); - - i++; - setTimeout(type, randomSpeed); - } - } - - type(); } \ No newline at end of file diff --git a/templates/default/html/about.html b/templates/default/html/about.html index 5636b28..dd0ae74 100644 --- a/templates/default/html/about.html +++ b/templates/default/html/about.html @@ -4,7 +4,7 @@
-