diff --git a/docs/blog/ibis-version-4.0.0-release.md b/docs/blog/ibis-version-4.0.0-release.md index 65e062a15642..20278079f6d9 100644 --- a/docs/blog/ibis-version-4.0.0-release.md +++ b/docs/blog/ibis-version-4.0.0-release.md @@ -13,7 +13,7 @@ Let’s talk about some of the new changes 4.0 brings for Ibis users. ## Backends -Ibis 4.0 brings [Polars](https://ibis-project.org/backends/Polars/), [Snowflake](https://ibis-project.org/backends/Snowflake/), and [Trino](https://ibis-project.org/4.0.0/backends/Trino/) into an already-impressive stock of supported backends. +Ibis 4.0 brings [Polars](https://ibis-project.org/backends/Polars/), [Snowflake](https://ibis-project.org/backends/Snowflake/), and [Trino](https://ibis-project.org/backends/Trino/) into an already-impressive stock of supported backends. The [Polars](https://www.pola.rs/) backend adds another way for users to work locally with DataFrames. The [Snowflake](https://www.snowflake.com/en/) and [Trino](https://trino.io/) backends add a free and familiar python API to popular data warehouses. diff --git a/gen_redirects.py b/gen_redirects.py new file mode 100644 index 000000000000..164a0d94db0a --- /dev/null +++ b/gen_redirects.py @@ -0,0 +1,53 @@ +import pathlib + +import mkdocs_gen_files + +HTML_TEMPLATE = """ + + + + + Redirecting... + + + + + + +Redirecting... + + +""" + +# Versions for templated redirects +VERSIONS = ["latest", "dev", "4.1.0", "4.0.0", "3.2.0", "3.1.0"] + +# Templated redirects +TEMPLATED_REDIRECTS = { + "/docs/{version}/": "/", + "/docs/{version}/install/": "/install/", + "/docs/{version}/docs/": "/docs/", + "/docs/{version}/backends/": "/backends/", +} + +# Untemplated redirects +REDIRECTS = {} + +# Fill in templates +REDIRECTS.update( + { + old.format(version=version): new + for version in VERSIONS + for old, new in TEMPLATED_REDIRECTS.items() + } +) + +# Write all redirect files +for old, new in REDIRECTS.items(): + if old.endswith("/"): + old = old + "index.html" + + html = HTML_TEMPLATE.format(url=new) + + with mkdocs_gen_files.open(pathlib.Path(old.lstrip("/")), "w") as f: + f.write(html) diff --git a/mkdocs.yml b/mkdocs.yml index 85b6c50a2510..7fb957a5949e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -45,6 +45,7 @@ plugins: - gen-files: scripts: - gen_matrix.py + - gen_redirects.py - macros - mkdocstrings: enable_inventory: true