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 publish doesn't work well with drafts in complex paths #4759

Closed
4 of 5 tasks
LittleYe233 opened this issue Aug 20, 2021 · 2 comments
Closed
4 of 5 tasks

hexo publish doesn't work well with drafts in complex paths #4759

LittleYe233 opened this issue Aug 20, 2021 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@LittleYe233
Copy link

LittleYe233 commented Aug 20, 2021

Check List

Please check followings before submitting a new issue.

The third item is not checked because I think maybe it's not too difficult to solve, but I know little about NodeJS so I am not sure whether it is hard indeed.

Expected behavior

Using hexo publish <file> should move the correct draft to the _posts folder, even the given path has slashes.

Actual behavior

Hexo thinks the given file doesn't exist.

How to reproduce?

  • hexo new draft 'test title' -p 'folder1/folder2/test title'
  • hexo publish 'folder1/folder2/test title'

Step 1 output message:

INFO  Validating config
INFO  Created: /path/to/my/repo/source/_drafts/folder1/folder2/test title.md

Step 2 output message:

INFO  Validating config
FATAL {
  err: Error: Draft "folder1-folder2-test-title" does not exist.
      at /path/to/my/repo/node_modules/hexo/lib/hexo/post.js:202:24
      at tryCatcher (/path/to/my/repo/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/path/to/my/repo/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/path/to/my/repo/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromise0 (/path/to/my/repo/node_modules/bluebird/js/release/promise.js:649:10)
      at Promise._settlePromises (/path/to/my/repo/node_modules/bluebird/js/release/promise.js:729:18)
      at _drainQueueStep (/path/to/my/repo/node_modules/bluebird/js/release/async.js:93:12)
      at _drainQueue (/path/to/my/repo/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/path/to/my/repo/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/path/to/my/repo/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (node:internal/timers:464:21)
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

Is the problem still there under "Safe mode"?

Yes.

Environment & Settings

Node.js & npm version(node -v && npm -v)

$ node -v
v16.6.2

$ npm -v
7.20.6

Your site _config.yml (Optional)

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: Little_Ye233's Personal Blog (Temporary)
subtitle: ''
description: ''
keywords:
author: Little_Ye233
language: zh-CN
timezone: 'Asia/Shanghai'

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: http://localhost
# root: /blog/
root: ''
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
  trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: true # Set to false to remove trailing '.html' from permalinks

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
  - ".github/**/*"

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
  enable: true # Open external links in new tab
  field: site # Apply to the whole site
  exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: true
marked:
  prependRoot: true
  post_asset_folder: true
relative_link: false
future: true
highlight:
  enable: false
  line_number: true
  auto_detect: false # default: false
  tab_replace: '    ' # default: ''
  wrap: true
  hljs: false
prismjs:
  enable: false
  preprocess: true
  line_number: true
  tab_replace: ''

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true
post_meta:
  updated_at: true
  another_day: false

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## updated_option supports 'mtime', 'date', 'empty'
updated_option: 'mtime'

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
  - ".github/**/*"
exclude:
ignore:

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: fluid # obsidian # default: landscape

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
  type: git
  ignore_hidden: false
  repo: <omitted>
  branch: master

# Posts
post:
  meta:
    min2read:
      enable: true
      format: "{} 分钟"
    views:
      enable: true
      format: "{} 次"
      source: "leancloud"
    comments:
      enable: true
      type: valine
  footnote:
    enable: true
    header: ''

# Code blocks
code:
  copy_btn: true
  highlight:
    enable: true
    line_number: true
    lib: "highlightjs"
    highlightjs:
      style: 'Solarized Dark'
      bg_color: false
    prismjs:
      style: "default"
      preprocess: true

Your theme _config.yml (Optional)

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: Little_Ye233's Personal Blog (Temporary)
subtitle: ''
description: ''
keywords:
author: 小叶Little_Ye
language: zh-CN
timezone: 'Asia/Shanghai'

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: http://localhost
# root: /blog/
root: ''
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
  trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: true # Set to false to remove trailing '.html' from permalinks

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link:
  enable: true # Open external links in new tab
  field: site # Apply to the whole site
  exclude: ''
filename_case: 0
render_drafts: false
post_asset_folder: true
marked:
  prependRoot: true
  post_asset_folder: true
relative_link: false
future: true
highlight:
  enable: false
  line_number: true
  auto_detect: false # default: false
  tab_replace: '    ' # default: ''
  wrap: true
  hljs: false
prismjs:
  enable: false
  preprocess: true
  line_number: true
  tab_replace: ''

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Metadata elements
## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
meta_generator: true

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss
## updated_option supports 'mtime', 'date', 'empty'
updated_option: 'mtime'
post_meta:
  updated_at: true
  another_day: false

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Include / Exclude file(s)
## include:/exclude: options only apply to the 'source/' folder
include:
exclude:
ignore:

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landscape # obsidian # default: landscape

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
  type: ''

Hexo and Plugin version(npm ls --depth 0)

$ npm ls --depth 0
<omitted>@0.0.0 
<omitted>
├── core-js@3.14.0
├── hexo-asset-link@2.1.0
├── hexo-deployer-git@3.0.0
├── hexo-generator-archive@1.0.0
├── hexo-generator-category@1.0.0
├── hexo-generator-index@2.0.0
├── hexo-generator-tag@1.0.0
├── hexo-renderer-ejs@1.0.0
├── hexo-renderer-marked@3.1.0
├── hexo-renderer-stylus@2.0.1
├── hexo-server@2.0.0
├── hexo-theme-fluid@1.8.11
├── hexo-theme-landscape@0.0.3
└── hexo@5.4.0

Your package.json package.json

{
  "name": "<omitted>",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "5.4.0"
  },
  "dependencies": {
    "core-js": "^3.14.0",
    "hexo": "^5.0.0",
    "hexo-asset-link": "^2.1.0",
    "hexo-deployer-git": "^3.0.0",
    "hexo-generator-archive": "^1.0.0",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-index": "^2.0.0",
    "hexo-generator-tag": "^1.0.0",
    "hexo-renderer-ejs": "^1.0.0",
    "hexo-renderer-marked": "^3.1.0",
    "hexo-renderer-stylus": "^2.0.0",
    "hexo-server": "^2.0.0",
    "hexo-theme-fluid": "^1.8.11",
    "hexo-theme-landscape": "^0.0.3"
  }
}

Others

@github-actions
Copy link

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stevenjoezhang
Copy link
Member

There is a discussion about it: #1821
I'm closing this issue. Please join the discussion there :)

@stevenjoezhang stevenjoezhang added duplicate This issue or pull request already exists and removed need-investigation labels Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants