Skip to content

Date in title regression when moving from v16 to v17 (readthedocs) #1382

Closed

Description

@styfle

I updated mkdocs from 0.16.0 to 0.17.2 and noticed the titles of my documents have changed.

I have a folder in the root of my site called meetings with several files that start with a date such as 2017-08-25-adfs-example.md. Some of them are just a date such as 2017-09-12.md.

Before (v16)

In version 16, the hyphens were stripped and this was fine.

v16

After (v17)

In version 17, the titles randomly change depending on which one I click. Sometimes it has a date in it, sometimes it doesnt.

v17

Activity

  1. waylan commented on Jan 17, 2018

    @waylan
    Contributor

    Yes, in #1180 the way page titles are determined was refactored (see nav.pyL213). As explained in the docstring:

    Get the title for a Markdown document
    Check these in order and return the first that has a valid title:
    - self._title which is populated from the mkdocs.yml
    - self.meta['title'] which comes from the page metadata
    - self.markdown - look for the first H1
    - self.input_path - create a title based on the filename
    

    If you were relying on the filename for page titles, that is the last possible method for determining a title. Presumably, one of the other methods are returning a title for some of your pages (my best guess is that some of your pages start with an h1 header). If you manually define a title for those pages using a method with higher priority, then you will be guaranteed to always have the title you want.

    Regarding the "regression" claim... The new feature (allow alternate ways to define page titles) has been a long-standing feature request (see #316). And using filenames has always been a fallback. Not defining titles and relying on the fallback is always going to be the most likely to run into unexpected changes. I'm inclined to not consider this a regression.

  2. styfle commented on Jan 17, 2018

    @styfle
    ContributorAuthor

    I understand now. Some of the documents didn't have an <h1> so they still show the date.

    However there appears to be a bug that is modifying the title in the menu bar depending on which document I click. It seems like when I click one file, the remaining files listed below go back to displaying the file name (as a date) instead of the <h1>.

    It's hard to explain so maybe I can try to reproduce with a new repository.

  3. waylan commented on Jan 17, 2018

    @waylan
    Contributor

    It sounds like you are experiencing the issue described in #1347. It appears that at that time I did not remember that the changes in #1180 had been applied.

  4. added this to the 1.0.0 milestone on Feb 6, 2018
  5. waylan commented on Jun 8, 2018

    @waylan
    Contributor

    Closing this as a duplicate of #1447.

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