mkdocs / mkdocs-redirects

Open source plugin for Mkdocs page redirects
MIT License
176 stars 25 forks source link

Cannot use variables #55

Closed steve-todorov closed 1 year ago

steve-todorov commented 1 year ago

Hey,

Redirection fails when you have the following mkdocs.yaml configuration:

extra:
  my_url: https://google.com

redirect-page.md

redirect: {{ my_url }}

The {{ my_url }} variable is treated as a literal and the redirection link becomes http://host/%7B%7B%20my_url%20%7D%7D.

oprypin commented 1 year ago

There's no such {{ feature whatsoever, indeed this is what is expected to happen.

steve-todorov commented 1 year ago

I believe you might have dismissed this this ticket as invalid too early. As per mkdocs documentation you can use the extra key/values which are rendered in .md files just fine. However, when the md file has only redirect: {{ my_url }} it does not work. I don't see this as "expected". Maybe I am confused?

oprypin commented 1 year ago

This sequence of characters is not present anywhere on that page: {{

steve-todorov commented 1 year ago

There seems to be a misunderstanding.

I have a md page which has the redirect: {{ my_url }} inside. my_url is defined via the extra key in mkdocs.yaml.

When you go to the page, it redirects to http://host/%7B%7B%20my_url%20%7D%7D instead of actually getting the my_url value from the mkdocs extra.

oprypin commented 1 year ago

I have a md page which has the redirect: {{ my_url }} inside.

Even disregarding the curly braces (that MkDocs never considers as anything special), this is also actually not a feature that this plugin has. It never looks inside *.md files.

Even trying to search for such a redirect plugin that looks into *.md files didn't yield any results for me.

steve-todorov commented 1 year ago

Ahh.. ok I see. Thanks for your replies! :)