hexo-theme-landscape icon indicating copy to clipboard operation
hexo-theme-landscape copied to clipboard

Override the theme settings

Open ghost opened this issue 7 years ago • 5 comments

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

ghost avatar Mar 13 '18 16:03 ghost

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?

tomap avatar Feb 25 '19 06:02 tomap

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.

M1ke avatar Apr 08 '20 15:04 M1ke

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 || :",

FossPrime avatar Jun 26 '21 05:06 FossPrime

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?

tomap avatar Jun 26 '21 16:06 tomap

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.

FossPrime avatar Jun 26 '21 23:06 FossPrime