mystmd icon indicating copy to clipboard operation
mystmd copied to clipboard

Rewrite internal links to include `.html` for static html (based on config)

Open agoose77 opened this issue 1 year ago • 4 comments
trafficstars

Building a trivial site from the following Markdown (duplicated into test.md and test2.md), the generated navigation points to test2, not test2.html.

Content:

# Test!
Hello world

:::{note} A Note!
Some markdown
:::

Config:

# See docs at: https://mystmd.org/guide/frontmatter
version: 1
project:
  # title:
  # description:
  keywords: []
  authors: []
  github: https://github.com/executablebooks/mystmd
  # bibliography: []
site:
  template: book-theme
  # title:
  # options:
  #   logo: site_logo.png
  nav: []
  actions:
    - title: Learn More
      url: https://mystmd.org/guide
  domains: []

Build:

npx myst build --html

Is this intended?

agoose77 avatar Mar 04 '24 18:03 agoose77

Oh, I didn't check the issues before creating #984. This is probably part of the #188.

npx serve seems to do the redirection automatically. So this might also be something that the site hosting can fix/

Checking a local sphinx build, it seems that all of the links point to a .html suffixed page, so it might be better to use that approach as well.

LecrisUT avatar Mar 18 '24 11:03 LecrisUT

This is intended as this is usually handled by static web servers (e.g. github pages, npx serve, python webserver, etc.), but we may need to handle this for CircleCI and RTD.

rowanc1 avatar Jun 05 '24 14:06 rowanc1

Just as a data point: python -m http.server with python 3.12.4 seems to be affected too: links such as https://0.0.0.0:8000/valeurs-types generated by myst fail, but adding manually a .html makes them work.

nthiery avatar Aug 20 '24 21:08 nthiery