From cd024096652f7435a511f7a6dcdd3a013875912d Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Fri, 6 Aug 2021 23:52:28 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=A8=A1=E7=89=88?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archetypes/moments.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/archetypes/moments.md b/archetypes/moments.md index 5a6a922..46ac5c0 100644 --- a/archetypes/moments.md +++ b/archetypes/moments.md @@ -1,6 +1,8 @@ --- -# 名称 +# 名称(不填写则为设置的默认名称) name: + +# 头像(不填写则为设置的默认头像) avatar: # 发布时间 @@ -11,6 +13,7 @@ tags: - - +# 附加信息(选填1项或者不填写) # 附加信息类型1:单个图片 pic: @@ -19,21 +22,17 @@ pic_set: - - -# 附加信息类型3:链接 +# 附加信息类型3:网页链接 +# link:必填,网页链接; +# link_text:必填,链接显示的文字; +# link_logo:选填,网页logo,现在支持部分网站自动找到对应图标,无需自己添加图标 link: -link_logo: link_text: +link_logo: # 备注信息 note: --- - - - -==================== -微信: wechat.svg -b站:bilibili.png -知乎:zhihu.svg -==================== + From 9211681f7195a78ec52835e4be51db850f6287e7 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Sun, 8 Aug 2021 18:25:35 +0800 Subject: [PATCH 02/11] update readme --- README.md | 32 ++++++++++++++++++++++++++++++++ theme.toml | 14 ++++---------- 2 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e4d1fbb --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +

Hugo 主题 Moments | Demo

+ +
+ + +Moments是一款Hugo主题,它为你提供了一个兼具社交性与私密性的记录分享空间。 + +它可以是你的朋友圈,并利用RSS把你的moment推送给那些你想告诉的人; + +它可以是你的私人手帐,将你的moment打印出来放进日记本的夹层里面; + +它也可以是你的社交账号,附在博客旁,贴上那些短小精干的moment; + +它还可以是你们的团队平台,和朋友、队友们一起创建属于你们的moments。 + + +## Screenshot + +![demo](https://z3.ax1x.com/2021/08/08/flwRF1.png) + + + + + + + \ No newline at end of file diff --git a/theme.toml b/theme.toml index 6be5d9d..26552c2 100644 --- a/theme.toml +++ b/theme.toml @@ -3,19 +3,13 @@ name = "Moments" license = "MIT" -licenselink = "https://github.com/yourname/yourtheme/blob/master/LICENSE" +licenselink = "https://github.com/FarseaSH/hugo-theme-moments/blob/master/LICENSE" description = "" -homepage = "http://example.com/" +homepage = "https://github.com/FarseaSH/hugo-theme-moments" tags = [] features = [] min_version = "0.41" [author] - name = "" - homepage = "" - -# If porting an existing theme -[original] - name = "" - homepage = "" - repo = "" + name = "FarseaSH" + homepage = "https://www.yyshao.com" From a2098322ab20b3090202b90e10964a93af986826 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Wed, 11 Aug 2021 10:54:13 +0800 Subject: [PATCH 03/11] readme first edition --- README.md | 194 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 186 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e4d1fbb..1a01db6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@
-Moments是一款Hugo主题,它为你提供了一个兼具社交性与私密性的记录分享空间。 +Moments是一款Hugo主题,用于短文发布,它为你提供了一个兼具社交性与私密性的记录分享空间。 它可以是你的朋友圈,并利用RSS把你的moment推送给那些你想告诉的人; @@ -18,15 +18,193 @@ Moments是一款Hugo主题,它为你提供了一个兼具社交性与私密性 ![demo](https://z3.ax1x.com/2021/08/08/flwRF1.png) - ```bash +$ hugo new site my_moments_name +$ cd my_moments_name $ git clone https://github.com/FarseaSH/hugo-theme-moments themes/moments -``` --> +``` - +### 配置 - - \ No newline at end of file +将以下设置覆盖到`config.toml`文件中 + +```toml +baseURL = "https://farseash.github.io/demo-hugo-theme-moments/" +languageCode = "zh-Hans" +theme = "moments" +paginate = 10 +paginatePath = '.' + +[params] + title = "Moments Demo" + signature = "人生如逆旅,我亦是行人。" + cover = "https://cdn.pixabay.com/photo/2018/03/13/22/53/puzzle-3223941_1280.jpg" + + name = "Default User" + avatar = "/img/default_avatar.png" +``` + +### 创建新的Moment + +``` +hugo new moments/your_moments_name.md +``` + +再进入`content/moments`文件夹打开相应的markdown文件进行编辑。 + + +### 将自己的Moments发布到网上 + +请参考Hugo文档deploy部分[Hugo Deploy | Hugo](https://gohugo.io/hosting-and-deployment/hugo-deploy/) + + +## 更多的设置 + +### 修改配置文件 `config.toml` + +修改对应配置文件`config.toml`中的参数,以满足你的要求。对于下面没有提及的参数,请不要修改。 + +- `baseURL`: 你所部署发布的网站地址。如果你的主页url是在域名子路径下(如 http://site.com/subpath/),请务必设定此项。 +- `paginate`: 单一页面上,显示的Moment的数量 +- `title`: 页面顶端的标题 +- `signature`: 页面顶端的签名 +- `cover`: 页面顶端的封面图 +- `name`: Moment默认发布人 +- `avatar`: Moment默认发布人的头像 + +### 各种类型Moment的模板 + +#### 纯文字 + +[![fNGzbF.png](https://z3.ax1x.com/2021/08/11/fNGzbF.png)](https://imgtu.com/i/fNGzbF) + +``` +--- +# 名称 +name: +avatar: + +# 发布时间 +date: 2021-08-01T11:33:28+08:00 + +# 给Moment添加标签 +tags: + - default + - + +# 附加信息类型1:单个图片 +pic: + +# 备注信息 +note: 这是纯文字的moment +--- +当然,你也可以什么都不附带,只发送纯文字moment。 +``` + +#### 单一图片 + +[![fNYnyV.png](https://z3.ax1x.com/2021/08/11/fNYnyV.png)](https://imgtu.com/i/fNYnyV) + +``` +--- +# 名称 +name: 福斯特 +avatar: https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn17%2F0%2Fw400h400%2F20181111%2F89f9-hnstwwq6307162.jpg&refer=http%3A%2F%2Fn.sinaimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630729931&t=e8c4135ba966d5fbfd5d30adf96551c0 + +# 发布时间 +date: 2021-08-04T23:57:46+08:00 + +# 给Moment添加标签 +tags: + - 图片 + - 最新moment + +# 附加信息类型1:单个图片 +pic: https://cdn.pixabay.com/photo/2016/03/09/11/57/grand-canyon-1246248_1280.jpg + +# 备注信息 +note: 这是加入图片的moment +--- + +你可以为每条moment附带图片。 + +比如说,好看的风景: +``` + +#### 图片集 + +[![fNt5DK.png](https://z3.ax1x.com/2021/08/11/fNt5DK.png)](https://imgtu.com/i/fNt5DK) + +``` +--- +# 名称 +name: 赛肯德 +avatar: https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg11.360buyimg.com%2Fn1%2Fjfs%2Ft22180%2F273%2F1048905858%2F16927%2Fc863f2d8%2F5b1ee306Nc3fa41e8.jpg&refer=http%3A%2F%2Fimg11.360buyimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630730078&t=818b15beaf41cabfa800ddea79f89445 + +# 发布时间 +date: 2021-08-04T11:57:49+08:00 + +# 给Moment添加标签 +tags: + - 图片集 + - 美食 + +# 附加信息类型2:图片组 +pic_set: + - https://p8.itc.cn/images01/20210119/628400a0528c4dc696efdac8749b176d.jpeg + - https://img.uooyoo.com/img2017/5/9/2017050941664829.jpg + - https://cdn.pixabay.com/photo/2016/10/13/11/44/chocolates-1737503_1280.jpg + - https://cdn.pixabay.com/photo/2016/01/11/07/18/cupcakes-1133146_1280.jpg + +# 备注信息 +note: 这是附带图片集的moment +--- + +你也可以为每条moment附带更多的图片,做成图片集。 + +比如最近打卡的美食们: +``` + +#### 网页链接 + +[![fNNF8s.png](https://z3.ax1x.com/2021/08/11/fNNF8s.png)](https://imgtu.com/i/fNNF8s) + +``` +--- +# 名称 +name: 瑟德 +avatar: https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimage.biaobaiju.com%2Fuploads%2F20190822%2F14%2F1566456820-UokjFbWpuN.jpg&refer=http%3A%2F%2Fimage.biaobaiju.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1630729842&t=560fc243f983753c1f4541a1d9c0d365 + +# 发布时间 +date: 2021-08-03T11:57:40+08:00 + +# 给Moment添加标签 +tags: + - 链接 + - Github + - 不知道贴什么标签 + +# 附加信息类型3:链接 +link: https://www.github.com +link_logo: +link_text: GitHub - Where the world builds software · GitHub + +# 备注信息 +note: 这是加入链接的Moment +--- +你也可以像这样附带网络链接。 + +GitHub是通过Git进行版本控制的软件源代码托管服务平台,由GitHub公司(曾称Logical Awesome)的开发者Chris Wanstrath、P. J. Hyett和汤姆·普雷斯顿·沃纳使用Ruby on Rails编写而成。(引用自Wikipedia) +``` + +## 未来功能开发 + +- [ ] RSS订阅 +- [ ] Moments打印功能 +- [ ] 支持网页分享link的提供 \ No newline at end of file From 40dfc5036e08c83aba1ff345906c5b56695b27f6 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Wed, 11 Aug 2021 11:39:04 +0800 Subject: [PATCH 04/11] add top feature --- archetypes/moments.md | 3 +++ layouts/index.html | 20 +++++++++++--------- layouts/partials/row.html | 7 +++++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/archetypes/moments.md b/archetypes/moments.md index 46ac5c0..2a2a48d 100644 --- a/archetypes/moments.md +++ b/archetypes/moments.md @@ -1,4 +1,7 @@ --- +# 置顶 +top: + # 名称(不填写则为设置的默认名称) name: diff --git a/layouts/index.html b/layouts/index.html index 07e2292..090f7d0 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,7 @@ {{ define "main" }}
- {{ range .Paginator.Pages }} + {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }} + {{ range $paginator.Pages }} {{ partial "row.html" . }} {{ end }}
@@ -8,18 +9,19 @@ {{ define "pagination" }} - {{ if .Paginator.HasPrev }} + {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }} + {{ if $paginator.HasPrev }}
  • - Previous + Previous
  • {{ else }}
  • - Previous + Previous
  • {{ end }} - {{ $current_num := .Paginator.PageNumber }} - {{ range (seq 1 .Paginator.TotalPages) }} + {{ $current_num := $paginator.PageNumber }} + {{ range (seq 1 $paginator.TotalPages) }} {{ if (eq $current_num .)}}
  • {{.}}
  • {{ else }} @@ -27,13 +29,13 @@ {{ end }} {{end}} - {{ if .Paginator.HasNext }} + {{ if $paginator.HasNext }}
  • - Next + Next
  • {{ else }}
  • - Next + Next
  • {{ end }} {{ end }} \ No newline at end of file diff --git a/layouts/partials/row.html b/layouts/partials/row.html index b6b1435..ce79bf6 100644 --- a/layouts/partials/row.html +++ b/layouts/partials/row.html @@ -7,6 +7,13 @@
    + + {{ if gt .Params.top 0}} +
    + +
    + {{ end }} +
    From d924172cc003f87d806cc8d123fec3fc44783c65 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Wed, 11 Aug 2021 11:49:17 +0800 Subject: [PATCH 05/11] fix bug --- archetypes/moments.md | 4 ++-- layouts/index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/archetypes/moments.md b/archetypes/moments.md index 2a2a48d..9927594 100644 --- a/archetypes/moments.md +++ b/archetypes/moments.md @@ -1,6 +1,6 @@ --- -# 置顶 -top: +# 置顶 (如需置顶这片Moment, 则将值设定为大于0的整数) +top: 0 # 名称(不填写则为设置的默认名称) name: diff --git a/layouts/index.html b/layouts/index.html index 090f7d0..b77656f 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,6 @@ {{ define "main" }}
    - {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }} + {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top").Reverse }} {{ range $paginator.Pages }} {{ partial "row.html" . }} {{ end }} @@ -9,7 +9,7 @@ {{ define "pagination" }} - {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }} + {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top").Reverse }} {{ if $paginator.HasPrev }}
  • Previous From d8e369f6d7b6f418da90d7cd7dabf5afc2b9ac09 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Wed, 11 Aug 2021 12:02:44 +0800 Subject: [PATCH 06/11] bug fix about reverse --- archetypes/moments.md | 4 ++-- layouts/index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/archetypes/moments.md b/archetypes/moments.md index 9927594..783c538 100644 --- a/archetypes/moments.md +++ b/archetypes/moments.md @@ -1,6 +1,6 @@ --- -# 置顶 (如需置顶这片Moment, 则将值设定为大于0的整数) -top: 0 +# 置顶 (如需置顶这片Moment, 则将值设定为大于0的整数, 值越小越靠前,例如1会将moment放在最顶端) +top: # 名称(不填写则为设置的默认名称) name: diff --git a/layouts/index.html b/layouts/index.html index b77656f..090f7d0 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,6 @@ {{ define "main" }}
    - {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top").Reverse }} + {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }} {{ range $paginator.Pages }} {{ partial "row.html" . }} {{ end }} @@ -9,7 +9,7 @@ {{ define "pagination" }} - {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top").Reverse }} + {{ $paginator := .Paginate ((where .Site.RegularPages "Section" "moments").ByParam "top") }} {{ if $paginator.HasPrev }}
  • Previous From 56d08fa3d2cd2cf8bb1dc5a59289b24b30ef0579 Mon Sep 17 00:00:00 2001 From: FarseaSH Date: Thu, 19 Aug 2021 11:56:48 +0800 Subject: [PATCH 07/11] fix the bug that bookmark could be clicked --- layouts/partials/after-content-js.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/after-content-js.html b/layouts/partials/after-content-js.html index 46ea518..a10b600 100644 --- a/layouts/partials/after-content-js.html +++ b/layouts/partials/after-content-js.html @@ -1,6 +1,6 @@