Skip to content

Search plugin: added option to put full nav path to the search result title - #2590

Closed
lord-vesel wants to merge 3 commits into
mkdocs:masterfrom
lord-vesel:master
Closed

lord-vesel wants to merge 3 commits into
mkdocs:masterfrom
lord-vesel:master

Conversation

@lord-vesel

@lord-vesel lord-vesel commented Sep 30, 2021 •

Copy link
Copy Markdown

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:

plugins:
    - search:
        full_path_in_title: yes

Tests for search plugin is updated too.

@oprypin

This comment was marked as abuse.

@oprypin

This comment was marked as abuse.

@oprypin

This comment was marked as abuse.

@lord-vesel

Copy link
Copy Markdown
Author

It seems to be working wrong

Thanks, and I think I fixed it, now it doesn't mess up internal section titles, modifying only the first title for section.
2021-10-10-19-39-21

Comment thread mkdocs/contrib/search/search_index.py Outdated
page_ancestors = []
full_title = ''

if len(page.ancestors):

This comment was marked as abuse.

@oprypin

This comment was marked as abuse.

@oprypin

This comment was marked as abuse.

@iagodvsantos

Copy link
Copy Markdown

Any plans to merge this PR? It would be useful in our context

@ossdhaval

Copy link
Copy Markdown

+1.
This feature would be useful to us too!! Path adds context to the search results, and that can help users decide which of the search result is the best fit.

@chuckwagoncomputing

Copy link
Copy Markdown

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.

@rusefillc

Copy link
Copy Markdown

@lord-vesel any chance to rebase?

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

Successfully merging this pull request may close these issues.

7 participants