I'm playing around with hexo, I'm testing the nunjuck syntax which work for a small loop. However I can't find how to include a file, I might be wrong in the location of my file (currently next to the .md
, in /source/_posts
).
Environment Info
Node version(node -v
):
node --version; npm --version
v8.9.1
5.5.1
Your site _config.yml
(Optional):
# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/
# Site
title: Hexo
subtitle:
description:
author: John Doe
language:
timezone:
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://yoursite.com
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:
# 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: true # Open external links in new tab
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:
# 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:
# 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
# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: landscape
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type:
</details>
Hexo and Plugin version(npm ls --depth 0
):
"hexo": "^3.2.0",
"hexo-generator-archive": "^0.1.4",
"hexo-generator-category": "^0.1.3",
"hexo-generator-index": "^0.2.0",
"hexo-generator-tag": "^0.2.0",
"hexo-renderer-ejs": "^0.3.0",
"hexo-renderer-stylus": "^0.3.1",
"hexo-renderer-marked": "^0.3.0",
"hexo-server": "^0.2.0"
Directory Structure
tree ./
./
├── include
│ └── colors.html
└── _posts
└── button6.md
Usage
npm install --save --only=prod hexo-include
In button6.md I added
{% include "include/colors.html" %}
Error
Unhandled rejection Template render error: (unknown path)
Error: template not found: include/colors.html
For question
I've this post in _hexo-demo/source/posts/button6.md
---
title: button6
myitems:
- one
- two
---
{% for item in myitems %}
<li> {{ item }}</li>
{% endfor %}
<hr>
{% include "colors.html" %}
Question
Where am I supposed to put my colors.html
file in order to be resolve