hexo-cli icon indicating copy to clipboard operation
hexo-cli copied to clipboard

No index.html in root directory

Open nikraza opened this issue 4 years ago • 6 comments

Installed hexo, created a new post, published, generated - no index.html in root directory. Browsing folders in browser generates 404 errors when I go to public folder (no 404 error) and follow any internal links to test posts I created.

nikraza avatar Jul 28 '21 08:07 nikraza

Hello, could you provide more details? Step by step to reproduce your issue, ...

There is a list to check: https://github.com/hexojs/hexo/blob/master/.github/ISSUE_TEMPLATE/bug_report.md

It would help us understand your issue

Thank you

tomap avatar Jul 28 '21 11:07 tomap

Hi @tomap.

It's hard for me to retrace my steps because I spent an evening trying to get the site going. I followed the official guide: installed prerequisites, then npm install -g hexo-cli. Everything looked fine.

Today, trying to replicate the problem I did: hexo new post mypost followed by hexo publish mypost. This gave me an error: Error: Draft "mypost" does not exist. Okay, let's try this then: hexo new draft mypost2 followed by hexo publish mypost2. This gives Error: Draft "mypost2" does not exist.

When I do hexo generate, the output, among other things, tells me an index.html in root has been generated but it's not there.

Obviously I tried hexo deploy as well. The only index.html file that's there is in public directory.

nikraza avatar Jul 29 '21 11:07 nikraza

My _config.yml file:

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

# Site
title: Hexo
subtitle: ''
description: ''
keywords:
author: John Doe
language: en
timezone: ''

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://nkrzv.com
# permalink: :year/:month/:day/:title/
permalink: :title/
permalink_defaults:
pretty_urls:
  trailing_index: false # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: false # 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: false
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace: ''
  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'

# 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: light

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

nikraza avatar Jul 29 '21 11:07 nikraza

theme: light

I see that your theme has been modified to light, did you add this theme to the themes directory?

jiangtj avatar Jul 30 '21 01:07 jiangtj

Yes, it's the only theme in there.

nikraza avatar Aug 01 '21 09:08 nikraza

I still cannot reproduce. Could you also provide the result of npm ls --depth 0

And the content of your package.json

tomap avatar Aug 21 '21 11:08 tomap