Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hexo发布如何将其发布到 source/_posts/[year]/[month]/ 这种结构下面 #1495

Closed
MaxCrazy1101 opened this issue Dec 1, 2024 · 6 comments

Comments

@MaxCrazy1101
Copy link

hexo发布如何将其发布到 source/_posts/[year]/[month]/ 这种结构下面

@terwer
Copy link
Owner

terwer commented Dec 2, 2024

路径暂时不支持动态配置,但是可以通过自定义文件名规则来实现。在 v1.29.1实现。

配置:
文件规则:[yyyy]/[MM]/[filename].md

其中,可用占位符如下,会动态替换:
[yyyy] 年,例如:2025
[MM] 月,例如:02
[mm]
[dd] 天 ,例如:26
[slug] 别名,例如:test-document-xdfr45f
[filename] 文件名,例如:测试文档
例如:[filename].md、[slug].md、[yyyy]-[mm]-[dd]-[slug].md
链接字符只能为 / - _ . ~ 其他的均会被移除。

image

效果

http://localhost:8002/terwer/hexo-blog/blob/main/source/_posts/2024/11/49.测试-6.md

image

terwer added a commit that referenced this issue Dec 2, 2024
@terwer terwer closed this as completed in ace0236 Dec 2, 2024
terwer added a commit that referenced this issue Dec 2, 2024
fix: #1495 support more filename pattern
terwer added a commit that referenced this issue Dec 2, 2024
@Achuan-2
Copy link

Achuan-2 commented Dec 2, 2024

不知道能不能搞一个[category]变量,根据分类来存放
@terwer

@terwer
Copy link
Owner

terwer commented Dec 2, 2024

chore(main): release siyuan-plugin-publisher 1.29.1 #1497

可以实现,分类是有多个的,例如 ["分类1","分类2"]

但是需要考虑下列问题
1、分类为空,忽略这个设置,好说;
2、分类为一个,好说;
3、分类多于一个怎么处理,处理成 分类1/分类2/... 还在只获取第一个 分类1/...@Achuan-2

@Achuan-2
Copy link

Achuan-2 commented Dec 2, 2024

@terwer
就获取第一个分类,我一般发hexo都是分类用一个,打多个tag标签,分类就当做文件夹,当做专栏

@terwer
Copy link
Owner

terwer commented Dec 2, 2024

我考虑了一下,新增两个变量
[category] 获取第一个分类,没有忽略
[cats] 所有分类组合起来

[tag] 获取第一个标签,没有忽略
[tags] 所有标签组合起来

这样应该可以满足所有用户的个性需求了。

关注 v1.29.2

@Achuan-2
Copy link

Achuan-2 commented Dec 2, 2024

我考虑了一下,新增两个变量 [category] 获取第一个分类,没有忽略 [cats] 所有分类组合起来

[tag] 获取第一个标签,没有忽略 [tags] 所有标签组合起来

这样应该可以满足所有用户的个性需求了。

关注 v1.29.2

可以的👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants