Skip to content

Commit

Permalink
fix: #1231 hexo not force use slug
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Nov 27, 2024
1 parent 3fdfeea commit bde70bc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Publish articles from siyuan-note to platforms like Yuque etc. `Free` and `open
**Encountered other issues or have suggestions? Group 1 is full, please join QQ Group 2 for discussion.**

[![](https://img.shields.io/badge/QQ%20Group-722632752-blue)](<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=fYrA79XDvtr4JuEgez-dmj1h3tOef8pg&jump_from=webapi&authKey=DC+XcjkoTH762jxvkSgpt7V97QFETnaLVTZIWhd8PdZoX+MNSr+LsprWFYYELXu8"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="发布工具2群" title="发布工具2群"></a>)
[![](https://img.shields.io/badge/QQ-722632752-blue)](https://qm.qq.com/cgi-bin/qm/qr?k=fYrA79XDvtr4JuEgez-dmj1h3tOef8pg&jump_from=webapi&authKey=DC+XcjkoTH762jxvkSgpt7V97QFETnaLVTZIWhd8PdZoX+MNSr+LsprWFYYELXu8)

The paid plugin [Share Pro](https://siyuan.wiki/s/20241115132719-3ivxe1y), also written by me, is now available. Share your notes with one click, welcome to follow.
## Update history
Expand Down
4 changes: 3 additions & 1 deletion src/adaptors/api/gitlab-hexo/useGitlabhexoApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const useGitlabhexoApi = async (key: string, newCfg?: GitlabhexoConfig) => {
const githubBranch = Utils.emptyOrDefault(process.env.VITE_GITLAB_BRANCH, "main")
const middlewareUrl = Utils.emptyOrDefault(process.env.VITE_MIDDLEWARE_URL, LEGENCY_SHARED_PROXT_MIDDLEWARE)
cfg = new GitlabhexoConfig(githubUsername, githubAuthToken, githubRepo, githubBranch, middlewareUrl)
cfg.mdFilenameRule = "[slug].md"
logger.info("Configuration is empty, using default environment variables.")
} else {
logger.info("Using configuration from settings...")
Expand All @@ -76,7 +77,8 @@ const useGitlabhexoApi = async (key: string, newCfg?: GitlabhexoConfig) => {
}

// 文件规则
cfg.mdFilenameRule = "[slug].md"
// 推荐别名。但是不强制使用
// cfg.mdFilenameRule = "[slug].md"
// 标签
cfg.tagEnabled = true
// 分类
Expand Down
4 changes: 3 additions & 1 deletion src/adaptors/api/hexo/useHexoApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const useHexoApi = async (key: string, newCfg?: HexoConfig) => {
const githubBranch = Utils.emptyOrDefault(process.env.VITE_GITHUB_BRANCH, "main")
const middlewareUrl = Utils.emptyOrDefault(process.env.VITE_MIDDLEWARE_URL, LEGENCY_SHARED_PROXT_MIDDLEWARE)
cfg = new HexoConfig(githubUsername, githubAuthToken, githubRepo, githubBranch, middlewareUrl)
cfg.mdFilenameRule = "[slug].md"
logger.info("Configuration is empty, using default environment variables.")
} else {
logger.info("Using configuration from settings...")
Expand All @@ -81,7 +82,8 @@ const useHexoApi = async (key: string, newCfg?: HexoConfig) => {
// [yyyy] 年
// [mm] 月
// [dd] 日
cfg.mdFilenameRule = "[slug].md"
// 推荐别名。但是不强制使用
// cfg.mdFilenameRule = "[slug].md"
// 标签
cfg.tagEnabled = true
// 分类
Expand Down
2 changes: 0 additions & 2 deletions src/adaptors/web/zhihu/zhihuWebAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ class ZhihuWebAdaptor extends BaseWebApi {
// this.logger.debug("get column initJson=>", initJson)
// const columns = initJson?.initialState?.entities?.columns ?? {}
// if (ObjectUtil.isEmptyObject(columns) || columns.length == 0) {
// debugger
// $(".List-item a.ColumnLink").each((index, element) => {
// // 在这里处理每个匹配的 a 标签
// const $a = $(element)
Expand All @@ -258,7 +257,6 @@ class ZhihuWebAdaptor extends BaseWebApi {
// const href = $a.attr("href")
// // 获取 div 内的文本
// const text = $div.text()
// debugger
// const cat = new CategoryInfo()
// cat.categoryId = href.split("/").pop()
// cat.categoryName = text
Expand Down
1 change: 0 additions & 1 deletion src/composables/usePublish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ const usePublish = () => {
const post = _.cloneDeep(doc) as Post
// 别名
const slug = ObjectUtil.getProperty(postMeta, SiyuanAttr.Custom_slug, post.wp_slug)
debugger
if (!StrUtil.isEmptyString(slug)) {
post.wp_slug = slug
logger.info("Using existing siyuan note slug")
Expand Down

0 comments on commit bde70bc

Please sign in to comment.