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

i can't found this function soucre code #197

Closed
senola opened this issue Mar 23, 2016 · 3 comments
Closed

i can't found this function soucre code #197

senola opened this issue Mar 23, 2016 · 3 comments

Comments

@senola
Copy link

senola commented Mar 23, 2016

file: site/themes/navy/layout/partial/sidebar.swig
i waut to change something, but i can not found this function soucre code. please help me
image

@D0n9X1n
Copy link
Member

D0n9X1n commented Mar 23, 2016

You can find this function in site/scripts/helpers.js line 45.

hexo.extend.helper.register('doc_sidebar', function(className){
  var type = this.page.canonical_path.split('/')[0];
  var sidebar = this.site.data.sidebar[type];
  var path = pathFn.basename(this.path);
  var result = '';
  var self = this;
  var prefix = 'sidebar.' + type + '.';

  _.each(sidebar, function(menu, title){
    result += '<strong class="' + className + '-title">' + self.__(prefix + title) + '</strong>';

    _.each(menu, function(link, text){
      var itemClass = className + '-link';
      if (link === path) itemClass += ' current';

      result += '<a href="' + link + '" class="' + itemClass + '">' + self.__(prefix + text) + '</a>';
    })
  });

  return result;
});

@senola
Copy link
Author

senola commented Mar 23, 2016

wo~ thank you very much!!

@Xuanwo
Copy link
Contributor

Xuanwo commented Mar 23, 2016

Closed for solved.

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