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

versioning doesn't appear on setup (serve locally) #185

Closed kurt-o-sys closed 9 months ago

kurt-o-sys commented 9 months ago

Summary

versioning doesn't appear on setup (serve locally) - I'm not sure that it's a bug, but I was asked to make it a bug: https://github.com/jimporter/mike/issues/183

Configuration and Logs

$ cat mkdocs.yml
site_name: Platform docs
site_url: https://skryv.github.io/skryv-docs

theme:
  name: material

extra:
  version:
    provider: mike

plugins:
  - mike:
      canonical_version: null
      version_selector: true
      css_dir: css
      javascript_dir: js
$ mike list
14.62 [LATEST]
14.61
$  mike serve
Starting server at http://localhost:8000/
Press Ctrl+C to quit.
127.0.0.1 - - [20/Oct/2023 14:54:53] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [20/Oct/2023 14:54:53] "GET /LATEST/ HTTP/1.1" 200 -
127.0.0.1 - - [20/Oct/2023 14:54:53] "GET /14.62/ HTTP/1.1" 200 -
127.0.0.1 - - [20/Oct/2023 14:54:53] "GET /14.62/assets/stylesheets/main.35e1ed30.min.css HTTP/1.1" 200 -
127.0.0.1 - - [20/Oct/2023 14:54:53] "GET /14.62/assets/javascripts/bundle.aecac24b.min.js HTTP/1.1" 200 -
127.0.0.1 - - [20/Oct/2023 14:54:53] "GET /14.62/assets/javascripts/bundle.aecac24b.min.js.map HTTP/1.1" 200 -
127.0.0.1 - - [20/Oct/2023 14:54:53] "GET /14.62/assets/images/favicon.png HTTP/1.1" 200 -
^CStopping server...
$  git checkout gh-pages
Switched to branch 'gh-pages'
$ ls -a
.             ..            .git          .nojekyll     14.61         14.62         LATEST        index.html    site          versions.json
$ git checkout main

The only commit I have:

$ git log
commit 10e68d29abe29a48dc6fece306a57ea2cacd0e83 (HEAD -> main)
$ git show
commit 10e68d29abe29a48dc6fece306a57ea2cacd0e83 (HEAD -> main)
Author: Kurt Sys <...>
Date:   Thu Oct 19 14:21:56 2023 +0200

    base setup

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1320f90
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+site
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 0000000..000ea34
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,17 @@
+# Welcome to MkDocs
+
+For full documentation visit [mkdocs.org](https://www.mkdocs.org).
+
+## Commands
+
+* `mkdocs new [dir-name]` - Create a new project.
+* `mkdocs serve` - Start the live-reloading docs server.
+* `mkdocs build` - Build the documentation site.
+* `mkdocs -h` - Print help message and exit.
+
+## Project layout
+
+    mkdocs.yml    # The configuration file.
+    docs/
+        index.md  # The documentation homepage.
+        ...       # Other markdown pages, images and other files.
diff --git a/mkdocs.yml b/mkdocs.yml
new file mode 100644
index 0000000..8a43faa
--- /dev/null
+++ b/mkdocs.yml
@@ -0,0 +1,16 @@
+site_name: Platform docs
+site_url: https://skryv.github.io/skryv-docs
+
+theme:
+  name: material
+
+extra:
+  version:
+    provider: mike
+
+plugins:
+  - mike:
+      canonical_version: null
+      version_selector: true
+      css_dir: css
+      javascript_dir: js
~

Steps to Reproduce

see also https://github.com/jimporter/mike/issues/183

  1. install mkdocs ( https://www.mkdocs.org/getting-started/ )
  2. run git init
  3. install and setup mike (https://github.com/jimporter/mike)
  4. change the title (or something else) and git add . and git commit -am "some message"
  5. run mike deploy 14.62 LATEST
  6. run mike deploy 16.61 (added this one to have at least to versions in the mike version list)
  7. run mike set-default LATEST
  8. run mike serve (or mkdocs serve)

Expected Behavior

Have a versioning dropdown in the generated docs

Additional Context

Versioning dropdown is not shown

With the default theme (mkdocs):

image

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

image

kurt-o-sys commented 9 months ago

somehow, the 4th time I did it, it worked fine.