Global variables in MkDocs

No, this is not possible at this time.

You say that you "use that variable in page". I'm assuming you mean a "Markdown" page. At this time template variables are not available in the Markdown pages. The template engine is not even run against the Markdown. The output of the Markdown parser is one of the variables passed to the template. For a more detailed explanation of how that works, see my answer to How do you include flask/jinja2 code inside a markdown file?.

Specific to MkDocs, there is an open issue (#304) discussing adding a feature to support some limited templating within the Markdown pages, but it is scheduled for post-1.0, so its not a top priority at this time.


As an update, it is possible to insert the variables from the extra slot in mkocs.yml, exactly as you describe.

To make this work, you need to install the markdownextradata plugin.