Mkdocs-material: Feature tab for external link in nav item

Created on 1 Oct 2018  路  8Comments  路  Source: squidfunk/mkdocs-material

I set nav Home is "http://mysite.com/", I have enable feature tab then tab Home not appear.
How can I add a tab Home to the menubar?

theme: 
    name: 'material'
    feature:
        tabs: true

nav:
    - Home: "http://mysite.com/"
    - Javascript:
        - Intro: javascript/index.md

Most helpful comment

Also, if this helps, you can open the link in new tab by using the following construct:

theme: 
    name: 'material'
    feature:
        tabs: true

nav:
    - Home: 
        - Intro: http://mysite.com/" target="_blank
    - Javascript:
        - Intro: javascript/index.md

Note: There are missing quotes in the external link value. It works like SQL injection where we inject this in anchor tag.

All 8 comments

I'm not sure MkDocs is supposed to work with an external page as the first item of a nav.

See https://www.mkdocs.org/user-guide/writing-your-docs/#index-pages, https://www.mkdocs.org/user-guide/configuration/#documentation-layout, and https://www.mkdocs.org/user-guide/writing-your-docs/#configure-pages-and-navigation

Also, see the site_url property.

If disable feature tab, nav Home with custom link working done in nav.

External links won't show up in the tab section - only sections with nested pages. You can, however, extend tab.html and insert your link within the template.

Can you intergrate this feature?My external link is site_url with another subfolder.

I am creating a document page with a lot of content categories.
And because material does not support searching for content under the current tab, I created each separate mkdocs page located in different subfolders of the domain and linked them in the feature tab.

Example:
mysite.com/javascript
mysite.com/html
mysite.com/php

I'm afraid no, it's not possible with MkDocs. You can override the theme as already stated.

Closing this as answered. It's not supported by MkDocs but can easily be solved via theme extension.

I have resolved with nested based on your suggestion

theme: 
    name: 'material'
    feature:
        tabs: true

nav:
    - Home: 
        - Intro: "http://mysite.com/"
    - Javascript:
        - Intro: javascript/index.md

Also, if this helps, you can open the link in new tab by using the following construct:

theme: 
    name: 'material'
    feature:
        tabs: true

nav:
    - Home: 
        - Intro: http://mysite.com/" target="_blank
    - Javascript:
        - Intro: javascript/index.md

Note: There are missing quotes in the external link value. It works like SQL injection where we inject this in anchor tag.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

40huo picture 40huo  路  3Comments

oliverschwendener picture oliverschwendener  路  4Comments

lupupitkanen picture lupupitkanen  路  4Comments

bborysenko picture bborysenko  路  4Comments

LinusGeffarth picture LinusGeffarth  路  3Comments