Skip to content

Fix submenu when path name is same#497

Merged
ivan-nginx merged 2 commits intotheme-next:masterfrom
jiangtj:fix-same-submenu
Dec 10, 2018
Merged

Fix submenu when path name is same#497
ivan-nginx merged 2 commits intotheme-next:masterfrom
jiangtj:fix-same-submenu

Conversation

@jiangtj
Copy link
Member

@jiangtj jiangtj commented Dec 10, 2018

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.
  • Tests for the changes have been added (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs have been added / updated (for bug fixes / features).

PR Type

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe:

What is the current behavior?

When submenu path name is same, submenu2 is rendered twice
image
image

Issue Number(s): N/A

What is the new behavior?

image
image

  • Screens with this changes: N/A
  • Link to demo site with this changes: N/A

Does this PR introduce a breaking change?

  • Yes.
  • No.

@ivan-nginx
Copy link
Member

Please, test it with this configuration:

menu:
  News: / || info-circle
  Docs:
    default: /docs/ || book
    Getting Started: /getting-started/ || flag
    Theme Settings: /theme-settings/ || star
    Third Party Services:
      default: /third-party-services/ || plug
      Algolia Search: /algolia-search/ || adn
    Tag Plugins: /tag-plugins/ || rocket
    Advanced Settings: /advanced-settings/ || rocket
    FAQ's: /faqs/ || life-ring
    Platforms: /platforms/ || retweet

https://github.com/theme-next/theme-next.org/blob/57db8ec03bc6da495ea94de733c27cc297988568/_config.yml#L158-L188

@jiangtj
Copy link
Member Author

jiangtj commented Dec 10, 2018

@ivan-nginx
Copy link
Member

image

@jiangtj here is bug founded: go to test sub-menu and then push second more breadcrumbs – will be 404 error.

BTW, breadcrumbs file generated here:

{% set paths = page.path.split('/') %}
{% set count = paths.length %}
{% if count > 2 %}
{% set current = 0 %}
{% set link = '' %}
<ul class="breadcrumb">
{% for path in paths %}
{% set current += 1 %}
{% if path != 'index.html' %}
{% if current == count - 1 %}
<li>{{ path | upper }}</li>
{% else %}
<li><a href="{{ link }}{{ url_for(path) }}/">{{ path | upper }}</a></li>
{% if link == '' %}
{% set link = '/' + path %}
{% else %}
{% set link += '/' + path %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</ul>
{% endif %}

@jiangtj
Copy link
Member Author

jiangtj commented Dec 10, 2018

image
May need change position
I try to fix it

@ivan-nginx
Copy link
Member

ivan-nginx commented Dec 10, 2018

Here it's description for subdirectory: https://github.com/hexojs/hexo-starter/blob/f04af381af085de6d3f19518efa433c585791688/_config.yml#L14-L17

And, yes, without subdirectory it's worked (on localhost).

@jiangtj
Copy link
Member Author

jiangtj commented Dec 10, 2018

@ivan-nginx Okay! Fixed.

Copy link
Member

@ivan-nginx ivan-nginx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah? GJ and HF, dude! 👍

@ivan-nginx ivan-nginx merged commit c87f6f8 into theme-next:master Dec 10, 2018
@ivan-nginx ivan-nginx added this to the v6.7.0 milestone Dec 10, 2018
@jiangtj jiangtj deleted the fix-same-submenu branch December 10, 2018 16:04
@stevenjoezhang stevenjoezhang changed the title fix submenu when path name is same Fix submenu when path name is same Sep 15, 2019
tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants