Skip to content

Override theme's scheme from main config [solved] #44

@SafeEval

Description

@SafeEval

I agree and want to create new issue


Expected behavior

The theme's scheme is correctly set from the main _config.yml file, using the theme_config setting explained here: hexojs/hexo#757

Actual behavior

All tested configuration settings can be set from a site's primary _config.yml file, except for scheme.

Steps to reproduce the behavior

Here is a short script that reproduces the behavior:

#!/bin/sh

# Initialize a hexo project with `hexo-cli`.
hexo init mytest
cd mytest
npm install

# Install the NeXT theme
git clone https://github.com/theme-next/hexo-theme-next themes/next
sed -i 's/theme: landscape/theme: next/g' _config.yml

# Configure the theme from the main config file, using `theme_config`
printf "
theme_config:
  scheme: Pisces
  menu:
    set from main: / || home

" >> _config.yml

# Serve the site on localhost:4000
hexo serve

When viewing the site, the theme's menu was properly overridden, but the theme's scheme was not.

  • Link(s) to source code or any useful link(s):

Node.js and NPM Information

node -v && npm -v
v8.4.0
5.6.0

Package dependencies Information

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.4.4"
  },
  "dependencies": {
    "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"
  }
}

Hexo Information

Hexo version

exo -v
hexo: 3.4.4
hexo-cli: 1.0.4
os: Linux 4.9.0-3-amd64 linux x64
http_parser: 2.7.0
node: 8.4.0
v8: 6.0.286.52
uv: 1.13.1
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.22.0
openssl: 1.0.2l
icu: 59.1
unicode: 9.0
cldr: 31.0.1
tz: 2017b

Hexo Configuration

Default, except for theme_config at the end.

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

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type:

theme_config:
  scheme: Pisces
  menu:
    set from main: / || home

NexT Information

NexT Version:

  • Latest Master branch.
  • Latest Release version.
  • Old version

NexT Scheme:

  • All schemes
  • Muse
  • Mist
  • Pisces
  • Gemini

NexT Configuration:

Default. No modifications: https://github.com/theme-next/hexo-theme-next/blob/7ee28e7d65681f06e509735697573ab857010b11/_config.yml

Other Information

hexothemeschemeconfig

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions