Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override the theme settings #102

Open
ghost opened this issue Mar 13, 2018 · 5 comments
Open

Override the theme settings #102

ghost opened this issue Mar 13, 2018 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 13, 2018

Hello,
In my _config.yml I can override the menu settings but not the sidebar parameter.
Has the override limitations for this theme ?

@tomap
Copy link
Contributor

tomap commented Feb 25, 2019

Can you rephrase the question and explain what you want to do, not what you want to override?
Do you want to hide the sidebar?

@M1ke
Copy link

M1ke commented Apr 8, 2020

I have the same issue. I have added the following in _config.yml:

theme_config:
  twitter: https://twitter.com/m1ke
  widgets:
  - tagcloud
  - recent_posts
  menu:
    About: /about/

The menu correctly updates to show about/ (though this doesn't actually hide Home & Archives) but the sidebar shows all widgets and Twitter link doesn't show. So it seems not all theme values can be overridden.

@FossPrime
Copy link

FossPrime commented Jun 26, 2021

Meanwhile a configurable sidebar comes around... I ended up using the package.json script "prebuild": "git apply theme.patch | :"

I generated the patch using git diff --no-index

This will break every minor version, but it's better than what we had in Hexo 4.

This also doesn't work in all environments, like yarn with protected node_modules, PNMP, shared node hosts like Runkit or Glitch.

// My package.json
    "re-install": "echo 'Node Bug Workaround.' && rm -r node_modules && npm install",
    "postinstall": "rm -r node_modules_orig || :; cp -a node_modules node_modules_orig",
    "prebuild": "git apply -p2 --directory='node_modules' patch || echo 'Patch already applied?'",
    "build": "hexo generate",
    "postbuild": "git diff --no-index node_modules_orig node_modules > patch || :",

@tomap
Copy link
Contributor

tomap commented Jun 26, 2021

Understood!
So by default, you need empty default configs in the theme which make it less friendly to start with. Less friendly defaults.

Not sure what you are proposing?

@FossPrime
Copy link

FossPrime commented Jun 26, 2021

This is primarily a problem with the Hexo API at this point. Though I've seen them state it's a problem with the theme.

With the _config.landscape.yml Hexo 5 endpoint, We currently have no exposed way of removing the Archived menu link, or removing any widgets.

I think what Hexo folks want us to do is use minimal defaults, unless the theme is completely unconfigured.

One way to do that would be to use have a minimal _config.yml, and with softlogic, such as checking if menu: is defined, show demo settings. Instead of configuring it in the internal _config.yml which currently takes precedence over the user level _config.landscape.yml file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants