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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search plugin: added option to put full nav path to the search result title #2590
base: master
Are you sure you want to change the base?
Conversation
Hi. Thanks for the contribution. Sorry that I haven't looked it in detail yet. Basically the main difficulty for a reviewer is... it's hard to decide whether this feature would have wide enough appeal to be "worth it". The code seems to be high-quality at a glance, though. I'll think about it more.
Something to keep in mind is that usually for any big open source project, the first thing you open should be an Issue. It's a better place to have an initial discussion, and an "opportunity" to get a rejection before putting work into an implementation. Some projects even require an issue to be opened, because there you can discuss the merits of the idea, and then discuss only implementation details in the pull request. |
You may also want to double-check that the email address you sign the commit with matches an email address in your GitHub account. As it is now, the commit wouldn't be attributed to your GitHub profile. |
It seems to be working wrong diff --git a/mkdocs.yml b/mkdocs.yml
index bfaeb5588..32fd9f5a4 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -7,7 +7,7 @@ repo_url: https://github.com/mkdocs/mkdocs/
edit_uri: ""
theme:
- name: mkdocs
+ name: material
locale: en
analytics: {gtag: 'G-274394082'}
highlightjs: true
@@ -53,7 +53,8 @@ markdown_extensions:
copyright: Copyright © 2014 <a href="https://twitter.com/_tomchristie">Tom Christie</a>, Maintained by the <a href="/about/release-notes/#maintenance-team">MkDocs Team</a>.
plugins:
- - search
+ - search:
+ full_path_in_title: true
- redirects:
redirect_maps:
user-guide/plugins.md: dev-guide/plugins.md |
page_ancestors = [] | ||
full_title = '' | ||
|
||
if len(page.ancestors): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when the page has no ancestors? Then the title is completely empty, and I think that's a problem. Or actually, I'm not noticing anything bad happening, but then why doesn't an empty title cause problems?
Note that I pushed my commit to your branch |
Any plans to merge this PR? It would be useful in our context |
+1. |
I had this idea myself, and here I find someone else had it before me! Please merge this. It would be super helpful for us, as we have headers that are identical to headers on other pages, and it's hard to figure out which page the search result is for. |
@lord-vesel any chance to rebase? |
Hi! Here is my first PR 馃榿
Added option
full_path_in_title
which allows to get not just page title in a search result, but full path separated with slashes, like: "Section 1 / Subsection / Page Title".To enable the feature, one has to add following to mkdocs.yml:
Tests for search plugin is updated too.