Skip to content

If no title is provided in the mkdocs.yml use the title in the markdown file #316

Closed

Description

@d0ugal

As per the title, this came up in #308 but it's something I've wanted for a while.

Activity

  1. added this to the 1.0.0 milestone on Jan 5, 2015
  2. 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
  3. ePirat commented on Jan 6, 2015

    @ePirat

    If this is done, have a look at #318, as this will be even more an issue then.

  4. lovelydinosaur commented on Jan 6, 2015

    @lovelydinosaur
    Collaborator

    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.

  5. d0ugal commented on Jan 6, 2015

    @d0ugal
    ContributorAuthor

    A few reasons.

    • 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.
  6. lovelydinosaur commented on Jan 6, 2015

    @lovelydinosaur
    Collaborator

    This one...

    We already guess the title based on the filename, we should try somewhere more useful first.

    Is a very good reason, agreed.

  7. jniggemann commented on Jan 27, 2015

    @jniggemann
    Contributor

    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?

  8. lovelydinosaur commented on Jan 27, 2015

    @lovelydinosaur
    Collaborator

    Either this:

    mkdocs.yml > md title > filename title
    

    Or this:

    mkdocs.yml > md title > [no title]
    

    Could be okay.

  9. d0ugal commented on Jan 27, 2015

    @d0ugal
    ContributorAuthor

    I'd vote for:

    mkdocs.yml > md title > filename title
    

    That looks like a reasonable place to do it, I've not had a look at this yet.

  10. dixhuit commented on Feb 23, 2015

    @dixhuit

    +1 for this, it would save on a fair bit of duplication. I'd also prefer as above:

    mkdocs.yml > md title > filename title
    
  11. modified the milestones: 0.13.0, 1.0.0 on Apr 22, 2015
  12. ugocupcic commented on Apr 22, 2015

    @ugocupcic

    From a discussion with @d0ugal on irc:

    Update filename_to_title nav.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.

  13. d0ugal commented on Apr 22, 2015

    @d0ugal
    ContributorAuthor

    @ugocupcic we should also rename filename_to_title to something like file_to_title as it wont just be looking at the filename anymore.

  14. 19 remaining items

  15. facelessuser commented on Jun 5, 2015

    @facelessuser
    Contributor

    I agree, a refactoring of nav is going to hav to come first. Glad I am not the only one interested in this.

  16. modified the milestone: 0.15.0 on Jan 14, 2016
  17. marcelstoer commented on Feb 24, 2016

    @marcelstoer

    First, I think the nav stuff needs to be refactored

    Was that done in the meantime i.e. those who were interested in at taking a stab at this feature should come forward again?

  18. d0ugal commented on Feb 25, 2016

    @d0ugal
    ContributorAuthor

    First, I think the nav stuff needs to be refactored

    Was that done in the meantime i.e. those who were interested in at taking a stab at this feature should come forward again?

    Nah, I started but never completed. There hasn't been enough volunteer time available (from me, or anyone else) to push this forward.

  19. memeplex commented on Aug 4, 2016

    @memeplex
    Contributor

    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.

  20. memeplex commented on Aug 4, 2016

    @memeplex
    Contributor

    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.

  21. added this to the 1.0.0 milestone on Dec 2, 2016
  22. waylan commented on Jan 17, 2018

    @waylan
    Contributor

    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.

  23. memeplex commented on Apr 30, 2018

    @memeplex
    Contributor

    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

  24. waylan commented on Apr 30, 2018

    @waylan
    Contributor

    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.

  25. added a commit that references this issue on Jan 18, 2025
    4b8687e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions