Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Related Links broken when linking to blog posts #4374

Closed
5 tasks done
davelevine opened this issue Sep 18, 2022 · 5 comments
Closed
5 tasks done

Related Links broken when linking to blog posts #4374

davelevine opened this issue Sep 18, 2022 · 5 comments
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open

Comments

@davelevine
Copy link
Sponsor

davelevine commented Sep 18, 2022

Contribution guidelines

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
  • ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

When linking to an existing blog post, a 404 error is produced.

Expected behaviour

The Related Links should work without error.

Actual behaviour

Linking to a blog post using the relative path of the Markdown file results in a 404 error. This can be seen in the official docs for two of the blog posts...

Both "Chinese search support" & "Excluding content from search" link to https://squidfunk.github.io/mkdocs-material/blog/posts/search-better-faster-smaller/, which produces a 404 error.

When adding a related link such as Hello World!, mkdocs serve fails with the following error:

ERROR - Blog post 'blog/posts/example.md' has no date set.

Steps to reproduce

Using either of the following will not let the documentation build:

---
date: 2022-09-17
links:
    - blog/posts/example.md
---
---
date: 2022-09-17
links:
    - [Example}(blog/posts/example.md)
---

Package versions

Python: Python 3.9.
MkDocs: mkdocs, version 1.3.1
Material: Version: 8.5.0+insiders.4.23.3

Configuration

site_name: My Docs
docs_dir: content
theme: 
  name: material
  custom_dir: theme
  include_search_page: false
  search_index_only: true
  features:
    - navigation.tabs
    - navigation.tabs.sticky
    - navigation.top
    - navigation.tracking
    - navigation.instant
    - navigation.indexes
    - search.suggest
    - search.share
    - announce.dismiss
    - content.code.annotate
    - content.tooltips
plugins:
  # Built-in
  - search:
      separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;'
  # Extra
  - git-revision-date-localized:
      type: timeago
      enable_creation_date: true
      exclude:
        - index.md
        - blog/archive/*
        - blog/category/*
  - glightbox:
      touchNavigation: true
      loop: false
      effect: zoom
      width: 100%
      height: auto
      zoomable: true
      draggable: true
  - minify:
      minify_html: true
  - offline:
      enabled: !ENV [OFFLINE, false]
  # Ensure Data Privacy
  - privacy:
      enabled: !ENV [PRIVACY, true]
      externals: bundle
      externals_dir: assets/externals
  - blog
nav:
  - Home: 'index.md'
  - Blog:
    - 'blog/index.md'

System information

Operating system: ... macOS 12.5.1
Browser: ... Firefox 104.0.2

Edit: Fixed formatting.

@squidfunk
Copy link
Owner

squidfunk commented Sep 18, 2022

Thanks for reporting. This syntax is wrong, you must use nav syntax:

---
date: 2022-09-17
links:
    - [Example}(blog/posts/example.md)
---

This is correct:

---
date: 2022-09-17
links:
    - Example: blog/posts/example.md
---

However, I'm able to reproduce the problem on our documentation and this is not intended, I'll look into it.

@squidfunk squidfunk added the bug Issue reports a bug label Sep 18, 2022
@squidfunk
Copy link
Owner

Fixed in squidfunk/mkdocs-material-insiders@8ea5da861.

@squidfunk squidfunk added the resolved Issue is resolved, yet unreleased if open label Sep 18, 2022
@davelevine
Copy link
Sponsor Author

Thanks for clarifying the syntax and for resolving this so quickly! The fix is now working on my end.

Also, the blog plugin is fantastic. I can't wait to see all that comes next.

@squidfunk
Copy link
Owner

Also, the blog plugin is fantastic. I can't wait to see all that comes next.

Thanks! Glad to hear that. All feedback is welcome 😊

@squidfunk
Copy link
Owner

Released as part of 8.5.2-insiders-4.23.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug resolved Issue is resolved, yet unreleased if open
Projects
None yet
Development

No branches or pull requests

2 participants