Skip to content
New issue

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

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

Already on GitHub? # to your account

forbid theme's config to override main config #1443

Closed
3100 opened this issue Aug 10, 2015 · 2 comments
Closed

forbid theme's config to override main config #1443

3100 opened this issue Aug 10, 2015 · 2 comments

Comments

@3100
Copy link

3100 commented Aug 10, 2015

This issue is similar to #756 but is a simpler idea.

I want to use a same theme in some blogs without doing customize the theme's config file. One blog's url contains subdirectory and another's does not, so the following menu config does not work in the first case:

menu:
  Home: /
  Archives: /archives

I found #583 as a similar issue but it does not solve the problem. ( if you click the title of an article and then click archive link, your browser will show 404 because it is 'relative' link to the article. )
And another thing, if you set your menu to your main config, it will be overiden by your theme' config. This seems weird to me. If there is no reasonable cause, it would be better if the main config were always prior. If so, I have only to change some blog's main config like below:

menu:
  Home: /subdirectory/
  Archives: /subdirectory/archives
@3100
Copy link
Author

3100 commented Aug 10, 2015

Sorry, I've detected where this priority rule is coded and understood that theme_config is suited for this case.

Locals.prototype.theme = _.extend({}, config, theme.config, config.theme_config);

in _/lib/hexo/index.js_

Now I edited my main config like below and it works perfectly:

theme_config:
  menu:
    Home: /subdirectory/
    Archives: /subdirectory/archives

@3100 3100 closed this as completed Aug 10, 2015
@dontpanic92
Copy link

I don't think writing 'subdirectory' many times is a good idea because we have already pointed out the root directory in 'root' option.

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

No branches or pull requests

2 participants