jimporter / mike

Manage multiple versions of your MkDocs-powered documentation via Git
BSD 3-Clause "New" or "Revised" License
511 stars 45 forks source link

[HELP WANTED] versioning doesn't appear on setup (serve locally) #183

Closed kurt-o-sys closed 9 months ago

kurt-o-sys commented 9 months ago

Hi, I'm trying to use mike, but apparently, I fail:

  1. install mkdocs ( https://www.mkdocs.org/getting-started/ )
  2. run git init
  3. install and setup mike (https://github.com/jimporter/mike)
  4. run mike deploy 14.61 LATEST
  5. run mike serve (or mkserve)

I never get the versions dropdown to see.

What am I doing wrong?

Thx, Kurt

--

With the default theme (mkdocs):

image

With the material theme (https://squidfunk.github.io/mkdocs-material/getting-started/):

image

--

In the logs, versions.json is not found:

$ mkdocs serve 
INFO    -  DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
             File "/opt/homebrew/lib/python3.11/site-packages/mike/mkdocs_plugin.py", line 6, in <module>
               from pkg_resources import iter_entry_points
             File "/opt/homebrew/lib/python3.11/site-packages/pkg_resources/__init__.py", line 118, in <module>
               warnings.warn(
INFO    -  Building documentation...
INFO    -  Cleaning site directory
INFO    -  Documentation built in 0.12 seconds
INFO    -  [14:46:23] Watching paths for changes: 'docs', 'mkdocs.yml'
INFO    -  [14:46:23] Serving on http://127.0.0.1:8000/skryv-docs/
WARNING -  [14:46:25] "GET /versions.json HTTP/1.1" code 404
INFO    -  [14:46:25] Browser connected: http://localhost:8000/skryv-docs/
WARNING -  [14:46:28] "GET / HTTP/1.1" code 302
INFO    -  [14:46:28] Browser connected: http://localhost:8000/skryv-docs/
WARNING -  [14:46:28] "GET /versions.json HTTP/1.1" code 404

$ mike serve
Starting server at http://localhost:8000/
Press Ctrl+C to quit.
127.0.0.1 - - [19/Oct/2023 14:47:36] code 404, message File not found
127.0.0.1 - - [19/Oct/2023 14:47:36] "GET /livereload/314215069/314219764 HTTP/1.1" 404 -
127.0.0.1 - - [19/Oct/2023 14:47:39] code 404, message File not found
127.0.0.1 - - [19/Oct/2023 14:47:39] "GET /livereload/314215069/314219764 HTTP/1.1" 404 -
127.0.0.1 - - [19/Oct/2023 14:47:40] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [19/Oct/2023 14:47:40] "GET /LATEST/ HTTP/1.1" 200 -
127.0.0.1 - - [19/Oct/2023 14:47:40] "GET /14.62/ HTTP/1.1" 200 -
127.0.0.1 - - [19/Oct/2023 14:47:40] "GET /14.62/assets/stylesheets/main.35e1ed30.min.css HTTP/1.1" 200 -
127.0.0.1 - - [19/Oct/2023 14:47:40] "GET /14.62/assets/javascripts/bundle.aecac24b.min.js HTTP/1.1" 200 -
127.0.0.1 - - [19/Oct/2023 14:47:40] "GET /14.62/assets/images/favicon.png HTTP/1.1" 200 -

--

$ cat mkdocs.yml
site_name: Platform docs
site_url: <site url>

theme:
  name: mkdocs 

extra:
  version:
    provider: mike

plugins:
  - mike:
      canonical_version: null
      version_selector: true
      css_dir: css
      javascript_dir: js
jimporter commented 9 months ago

Are you sure you're actually testing with mike serve (and not mkdocs serve)? The logs when you ran mike serve look correct to me. (It's expected that you'd get a 404 looking for versions.json with the latter, since MkDocs itself isn't aware of mike.)

If you still have problems, please refile a new issue and fill out the bug reporting form fully. I can't help with this unless I see the commits.