iissnan / hexo-theme-next

Elegant theme for Hexo.
http://notes.iissnan.com
MIT License
15.88k stars 3.62k forks source link

Double 'theme' parameter when using hexo datafiles [double spaces indents] #1948

Closed maddovr closed 7 years ago

maddovr commented 7 years ago

When using hexo datafiles(one big configuration file in _data) the value 'theme' is repeated twice, once in hexo site _config.yml and the other time in the footer option, causing an error which can only be avoided by deleting this option from the configuration file. Is it possible to rename it?

NeXT v5.1.3

ivan-nginx commented 7 years ago

Don't understand in what trouble. Can u explain it totally? Some examples or reproduce steps, etc. What options u enable, what disable? Need more info.

maddovr commented 7 years ago

When copypasting both _config.yml in hexo site root and next _config.yml in one big file, i.e next.yml in source/_data, with the latest version of next theme YAML throws out an error due to a duplicate variable, in this case theme:

The first one in hexo config determines what theme the site must use:

## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next 

The second one is the new NeXT copyright option down in the footer:

# Hexo link (Powered by Hexo).
  powered: true

  theme:
    # Theme & scheme info link (Theme - NexT.scheme).
    enable: true
    # Version info of NexT after scheme info (vX.X.X).
    version: false

This behavior causes YAML to throw out an error and crash, thus the site cannot be built unless you either delete the footer variable or stop using hexo datafiles for personalization(which prevents you from updating the theme without losing the config[ofc you might use a backup instead]). As such, is it possible to just rename that variable in order to prevent any conflict?

ivan-nginx commented 7 years ago

I see now. U add full NexT theme configs with footer, e.g.:

footer:
  # Specify the date when the site was setup.
  # If not defined, current year will be used.
  #since: 2015

  # Icon between year and copyright info.
  icon: user

  # If not defined, will be used `author` from Hexo main config.
  copyright:
  # -------------------------------------------------------------
  # Hexo link (Powered by Hexo).
  powered: true

  theme:
    # Theme & scheme info link (Theme - NexT.scheme).
    enable: true
    # Version info of NexT after scheme info (vX.X.X).
    version: true

Or u add only theme: without parent footer: configuration? Because basically this configs must readed by Hexo as footer: theme: ....


As i see in your data config, u use this options directly, without parent footer: option defined. How that configs works, i don't understand!

  1. Always need to define configs as they state: if they have parents and splited by double spaces (or more), that's mean they have parents and can be used only after parents defined.
  2. We may to rename theme: config on something about next:, but i think u understand what this is not a bug, but just not right configuration settings.
maddovr commented 7 years ago

Indeed my fault, the footer got copied but had the wrong alignment, thus theme was recognized as a parent. Very sorry about that and the issue can be closed. sorry for taking your time^^

ivan-nginx commented 7 years ago

Don't worry about this, just take a look on original configs twice before think what this is bug. Many errors just appear if u redefine not right config syntax. :smiley:

If solved, close it please.