New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add building extra templates #436

Merged
merged 1 commit into from May 2, 2015

Conversation

Projects
None yet
2 participants
@d0ugal
Member

d0ugal commented Apr 8, 2015

Add building extra templates
This is similar to extra_css and extra_javascript except it picks up
HTML and XML files and runs them through jinja2 with the global context.
This adds for quite a bit of flexability and allows people to easily add
custom site maps, static and templates htlp.

Fixes #28
Fixes #44

@d0ugal d0ugal added the Enhancement label Apr 8, 2015

@d0ugal d0ugal added this to the 0.13.0 milestone Apr 8, 2015

@waylan

This comment has been minimized.

Member

waylan commented Apr 9, 2015

This looks good but I guess I would have expected a more general solution. Why not have the XML template (and any user created HTML templates) placed among the Markdown source files. Then, rather than copy them as-is, run them through as templates with the global context like you do here. The new command would simply place a copy of the sitemap.xml file next to the index.md for new project (existing projects would have to manually add the file, but they will have to anyway). That gives users total control over both what the file contains (they can edit the default) and where it exists in their site's hierarchy (they can move it). And by also including HTML files, you fulfill other feature requests for free (see #28). Maybe the list of file extensions which get fed through as templates could be a configuration setting for ultimate flexibility.

@d0ugal

This comment has been minimized.

Member

d0ugal commented Apr 9, 2015

Yup, fair point. This was partly a rebase of #55 - I wasn't quite finished with it yet. Will mark that as such.

@d0ugal

This comment has been minimized.

Member

d0ugal commented Apr 24, 2015

Okay, finally thinking about this a bit more. I do really like the idea of a generic solution to this - I think I would be okay with parsing xml and html files only and not letting the user change that - we can always add that later if the hordes demand it later :)

However, I don't like the idea of having users copy the sitemap.xml file in - It's a manual process which most people wont care for.

So, I'm wondering, can we include it by default as this PR does, then we find the XML and HTML files in the docs_dir and build all of those, they would replace the defaults if the filename matches. The only downside I can see is that they wont be able to remove the default, but I don't think that is a huge issue.

@d0ugal d0ugal force-pushed the d0ugal:sitemap branch 2 times, most recently from 212e741 to 1d8b701 Apr 28, 2015

Add building extra templates
This is similar to extra_css and extra_javascript except it picks up
HTML and XML files and runs them through jinja2 with the global context.
This adds for quite a bit of flexability and allows people to easily add
custom site maps, static and templates htlp.

Fixes #28
Fixes #44

@d0ugal d0ugal force-pushed the d0ugal:sitemap branch from 1d8b701 to b5bd1c7 Apr 28, 2015

@d0ugal d0ugal changed the title from Added a sitemap to the build output to Add building extra templates Apr 28, 2015

@d0ugal

This comment has been minimized.

Member

d0ugal commented Apr 28, 2015

Updated this issue to reflect the above suggestions and change in approach.

d0ugal added a commit that referenced this pull request May 2, 2015

Merge pull request #436 from d0ugal/sitemap
Add building extra templates

@d0ugal d0ugal merged commit 7fa41ab into mkdocs:master May 2, 2015

3 checks passed

continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+2.35%) to 88.34%
Details

@d0ugal d0ugal deleted the d0ugal:sitemap branch May 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment