You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
If no title is provided in the mkdocs.yml use the title in the markdown file #316
changed the title [-]If no title is provided in the mkdocs.yml use the title in the markdown file.[/-][+]If no title is provided in the mkdocs.yml use the title in the markdown file[/+]on Jan 5, 2015
Keep the config file as minimal as possible (and remove duplication).
Reduce steps for new users, list all the pages vs list all the pages and add/check the titles (for example, when I done DRF, this would have really helped).
We already guess the title based on the filename, we should try somewhere more useful first.
Which one would take precedence over the other? I suggest the following:
title from mkdocs.yml > title from md file (meta) > title from filename (if all else fails)
Would we want to implement that in _generate_site_navigation()here?
Update filename_to_titlenav.py. Use python-markdown lib to parse the markdown and find if there's a title in the markdown file. Return it if there is, otherwise return the filename.
If you assume that the first toc entry is the title when there is no title meta, then you will be banning a header structure that reserves headers for sections and set no meta. I don't think there is a safe way to do this without adding an option to let the user signal his intention (at the global level) regarding: first header is title vs first header is section. There are many related issues reported, all revolving around the inability to tell the title appart from the document section outline in a reliable way, so title may be part of the templates, the toc may be consistently build across themes and there is no ambiguity regarding what is the title.
What do you think about my suggestion at #1008 (comment). It provides a way to programmaticaly alter the model according to user intentions that are hard to communicate without complicating the configuration file.
Hmm, just noticed we implemented this in #1180 (see nav.pyL213) and never closed this issue. Although, I don't believe it has been documented. I've relabeled this so we don't forget to document the behavior.
I don't think this is completely solved. The nav doesn't load page source and both title and meta are tied to the page being loaded in order to resolve properly. Since now title and meta have their own fast parsers (for top header and metadata section in md source), wouldn't it be desirable to load the page, extract title and meta, then unload it unless it's the current page and thus should be rendered? This would remove all inconsistencies regarding the availability and contents of title and meta in different contexts without having to keep the entire site in memory. Indeed, I thought that was the goal of adding the metadata parser.
This is all being addressed with the Pages refactor, which is happening regardless of this issue. That refactor will address the order in which things happen so any inconsistencies in determining page titles will be addresses by default.
Activity
[-]If no title is provided in the mkdocs.yml use the title in the markdown file.[/-][+]If no title is provided in the mkdocs.yml use the title in the markdown file[/+]ePirat commentedon Jan 6, 2015
If this is done, have a look at #318, as this will be even more an issue then.
lovelydinosaur commentedon Jan 6, 2015
I still don't entirely get the motivation for not wanting to maintain a properly listed index. It's essentially zero amount of real work/overhead.
d0ugal commentedon Jan 6, 2015
A few reasons.
lovelydinosaur commentedon Jan 6, 2015
This one...
Is a very good reason, agreed.
jniggemann commentedon Jan 27, 2015
Which one would take precedence over the other? I suggest the following:
title from mkdocs.yml > title from md file (meta) > title from filename (if all else fails)
Would we want to implement that in
_generate_site_navigation()here?lovelydinosaur commentedon Jan 27, 2015
Either this:
Or this:
Could be okay.
d0ugal commentedon Jan 27, 2015
I'd vote for:
That looks like a reasonable place to do it, I've not had a look at this yet.
dixhuit commentedon Feb 23, 2015
+1 for this, it would save on a fair bit of duplication. I'd also prefer as above:
ugocupcic commentedon Apr 22, 2015
From a discussion with @d0ugal on irc:
Update
filename_to_titlenav.py. Use python-markdown lib to parse the markdown and find if there's a title in the markdown file. Return it if there is, otherwise return the filename.d0ugal commentedon Apr 22, 2015
@ugocupcic we should also rename
filename_to_titleto something likefile_to_titleas it wont just be looking at the filename anymore.19 remaining items
facelessuser commentedon Jun 5, 2015
I agree, a refactoring of nav is going to hav to come first. Glad I am not the only one interested in this.
marcelstoer commentedon Feb 24, 2016
Was that done in the meantime i.e. those who were interested in at taking a stab at this feature should come forward again?
d0ugal commentedon Feb 25, 2016
Nah, I started but never completed. There hasn't been enough volunteer time available (from me, or anyone else) to push this forward.
memeplex commentedon Aug 4, 2016
If you assume that the first toc entry is the title when there is no title meta, then you will be banning a header structure that reserves headers for sections and set no meta. I don't think there is a safe way to do this without adding an option to let the user signal his intention (at the global level) regarding: first header is title vs first header is section. There are many related issues reported, all revolving around the inability to tell the title appart from the document section outline in a reliable way, so title may be part of the templates, the toc may be consistently build across themes and there is no ambiguity regarding what is the title.
memeplex commentedon Aug 4, 2016
What do you think about my suggestion at #1008 (comment). It provides a way to programmaticaly alter the model according to user intentions that are hard to communicate without complicating the configuration file.
waylan commentedon Jan 17, 2018
Hmm, just noticed we implemented this in #1180 (see nav.pyL213) and never closed this issue. Although, I don't believe it has been documented. I've relabeled this so we don't forget to document the behavior.
memeplex commentedon Apr 30, 2018
I don't think this is completely solved. The nav doesn't load page source and both title and meta are tied to the page being loaded in order to resolve properly. Since now title and meta have their own fast parsers (for top header and metadata section in md source), wouldn't it be desirable to load the page, extract title and meta, then unload it unless it's the current page and thus should be rendered? This would remove all inconsistencies regarding the availability and contents of title and meta in different contexts without having to keep the entire site in memory. Indeed, I thought that was the goal of adding the metadata parser.
Related to this: #1476
waylan commentedon Apr 30, 2018
This is all being addressed with the Pages refactor, which is happening regardless of this issue. That refactor will address the order in which things happen so any inconsistencies in determining page titles will be addresses by default.
Refactor writing-your-docs.md (mkdocs#1392)