Code Monkey home page Code Monkey logo

Comments (15)

ivan-nginx avatar ivan-nginx commented on June 11, 2024 1

Alright, find it. Need some time for fix, wait..

from hexo-theme-next.

ivan-nginx avatar ivan-nginx commented on June 11, 2024
# ---------------------------------------------------------------
# Theme Core Configuration Settings
# ---------------------------------------------------------------

# Set to true, if you want to fully override the default configuration.
# Useful if you don't want to inherit the theme _config.yml configurations.
override: false
theme_config:
+ override: true
  scheme: Pisces
  menu:
    set from main: / || home

In this case u need to copy all NexT settings from NexT config to Hexo config.


Or u can use data-files.

from hexo-theme-next.

ivan-nginx avatar ivan-nginx commented on June 11, 2024

@HuntedCodes if scheme: Muse option will be commented in default NexT config, all works fine?

from hexo-theme-next.

SafeEval avatar SafeEval commented on June 11, 2024

@ivan-nginx I just tried commenting out all schemes in themes/next/_config.yml.

Even with override: true, and all theme settings copied to the main _config.yml, Hexo still uses Muse.

Here are updated reproduction steps that I followed:

#!/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

# Append the entire NeXT config to main config, under 'theme_config:`
printf "\ntheme_config:\n" >> _config.yml
cat themes/next/_config.yml | sed 's/^/  /g' >> _config.yml

# Enable full theme override
sed -i 's/override: false/override: true/g' _config.yml

# Change scheme from "Muse" to "Pisces". Site should show Pisces scheme.
sed -i 's/scheme: Muse/#scheme: Muse/g' _config.yml
sed -i 's/#scheme: Pisces/scheme: Pisces/g' _config.yml

# Comment out the default scheme in the theme.
sed -i 's/scheme: Muse/#scheme: Muse/g' themes/next/_config.yml

# Change theme menu item to show theme_config is working correctly
sed -i 's/home:/XXXXXXX:/g' _config.yml

# Serve the site on localhost:4000
hexo serve

Thanks for pointing out Data Files. I hadn't seen those before.

from hexo-theme-next.

ivan-nginx avatar ivan-nginx commented on June 11, 2024

I also found this issue — theme config overwrite root config.
So, Hexo first read scheme: Pisces from root config and after that Hexo read default scheme: Muse from NexT config and override by it.

from hexo-theme-next.

SafeEval avatar SafeEval commented on June 11, 2024

That issue references the pull request that implemented theme_config (hexojs/hexo#757). There is also PR to have it documented (hexojs/site#634).

from hexo-theme-next.

ivan-nginx avatar ivan-nginx commented on June 11, 2024

Ok, but u comment #scheme: Muse option in default Next config, right?
So, we must get on out:

# ---------------------------------------------------------------
# Scheme Settings
# ---------------------------------------------------------------

# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
#scheme: Gemini

And we add in Hexo config this:

theme_config:
  scheme: Pisces

And still load Muse scheme with this settings? This override by commented #scheme: Pisces or what? A little bit strange.
Try to clear all commented schemes in default NexT config, still Muse loaded?

from hexo-theme-next.

SafeEval avatar SafeEval commented on June 11, 2024

Sure did, still loads Muse:

  • All schemes were commented out in themes/next/_config.yml.
  • All configuration settings were copied from themes/next/_config.yml to _config.yml, under theme_config.
  • Pisces was enabled in _config.yml.
  • Set override: true in both themes/next/_config.yml and _config.yml.

Main config file:

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

.......

theme_config:
  # ---------------------------------------------------------------
  # Theme Core Configuration Settings
  # ---------------------------------------------------------------
  
  # Set to true, if you want to fully override the default configuration.
  # Useful if you don't want to inherit the theme _config.yml configurations.
  override: true
  
.......

  menu:
    XXXXXXX: / || home

.......
  
  # ---------------------------------------------------------------
  # Scheme Settings
  # ---------------------------------------------------------------
  
  # Schemes
  #scheme: Muse
  #scheme: Mist
  scheme: Pisces
  #scheme: Gemini
  
.......

NeXT config file:

# ---------------------------------------------------------------
# Theme Core Configuration Settings
# ---------------------------------------------------------------

# Set to true, if you want to fully override the default configuration.
# Useful if you don't want to inherit the theme _config.yml configurations.
override: true

.......

# ---------------------------------------------------------------
# Scheme Settings
# ---------------------------------------------------------------

# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
#scheme: Gemini

.......

from hexo-theme-next.

ivan-nginx avatar ivan-nginx commented on June 11, 2024

Please, try to reproduce steps above.

from hexo-theme-next.

SafeEval avatar SafeEval commented on June 11, 2024

I updated my comment above, to remove the extra settings. It shows the config files, from after the steps were reproduced, that generate Muse instead of Pisces.

The above script automatically reproduces the steps.

from hexo-theme-next.

ivan-nginx avatar ivan-nginx commented on June 11, 2024
  1. Don't need to touch override option anymore.
  2. When u see generated Muse theme, in the footer u see «Theme — NexT.Muse v6.0.1» or «Theme — NexT.Pisces v6.0.1»? Because i trying to change on Gemini and see Gemini in footer, but current visual scheme is still Muse. Can u confirm it?

from hexo-theme-next.

SafeEval avatar SafeEval commented on June 11, 2024

Confirmed. Even though the style shows Muse, the footer says:

Theme — NexT.Pisces v6.0.1

from hexo-theme-next.

ivan-nginx avatar ivan-nginx commented on June 11, 2024

@HuntedCodes ok, fixed in 1b0b53a

Detailed full instructions already updated in data-files docs and for now u can use any options from NexT with theme_config + 2 spaces indent in main Hexo config (as u used above, without override option (it's now only for data-files)) — all added options will be rewrited.


The trouble was in hexo-renderer-stylus which by default get all settings from theme's config, not from main Hexo config, without any fallback.


If issue solved, close it please.

from hexo-theme-next.

SafeEval avatar SafeEval commented on June 11, 2024

The fix works. Thanks for the quick remediation!

Configuration is so much simpler now, without override or touching the theme's config file:

  1. Initialize a Hexo project
  2. Install the NeXT theme
  3. Add theme_config with scheme: Pisces
  4. Serve the site
#!/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 NeXT scheme in main config
printf "\ntheme_config:\n  scheme: Pisces" >> _config.yml

# Serve the site on localhost:4000
hexo serve

from hexo-theme-next.

stevenjoezhang avatar stevenjoezhang commented on June 11, 2024

See also hexojs/hexo#3967

from hexo-theme-next.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.