Closed daxm closed 4 years ago
Please provide your mkdocs.yml for review and provide me at least with a tree _data
so i can see the structure you have created
something like
site_name: MkLorum
plugins:
- search
- markdownextradata
extra:
some_variable: value
will check for a folder located at
docs/_data/user.yml
and or (with 0.3.1 release)
./_data/user.yml
and write
{{user.name}}
in the template context (notice user is the name of the file in the _data dir)
assuming of course you define a name: bob
in the user.yml
Please check the latest 0.1.3 release for upgrade notes for multiple path handling
You bet! structure:
mkdocs
\_ mkdocs.yml
\_docs
\_sp1.md
\__data
\_datafile.yml
mkdocs.yml
site_name: Cisco Sales Plays
theme: windmill
plugins:
- search:
- markdownextradata:
extra:
user:
name: dax
email: dmickels@cisco.com
markdown_extensions:
- toc:
permalink: True
baselevel: 1
extra_javascript: [extra.js]
extra_css: [extra.css]
datafile.yml:
---
user:
name: dax
email: dmickels@cisco.com
sp1.md:
This sales play covers the Data Center features related to geographic redundancy and extending data to more locations.
## Enable Geographic Redundancy
{{ user.name }} - {{ user.email }}
Obviously I change the mkdocs.yml file to this when testing the datafile.yml format:
site_name: Cisco Sales Plays
theme: windmill
plugins:
- search:
- markdownextradata:
data: _data
markdown_extensions:
- toc:
permalink: True
baselevel: 1
extra_javascript: [extra.js]
extra_css: [extra.css]
plugins:
- search:
- markdownextradata:
should be
plugins:
- search:
- markdownextradata
notice the missing :
this is yaml
you either need
plugins:
- search:
- markdownextradata:{}
or
- markdownextradata
dont need this
plugins:
- search:
- markdownextradata:
data: _data
as that is the default behaviour
please install 0.1.3
\_data
\datafile.yml
only 1 _ in _data and you dont need it in the yaml file name
{{ datafile.user.name }} - {{ datafile.user.email }}
That fixed it! Thank you! Sorry for my misunderstanding. In hindsight it is obvious that I should have to include the filename's name as part of the variable. Doh!
no worries.. best of luck with your project
granted the docs were a bit bad on that point have improved them in 0.1.3
I can get the extra: {} format in the mkdocs.yml file to work just fine. However, when I move that same structure into a _data/datafile.yml file it doesn't. When I 'mkdocs build' I just get a traceback: