Skip to content
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

Allow using pretty URLs #485

Merged
merged 4 commits into from
May 21, 2017
Merged

Allow using pretty URLs #485

merged 4 commits into from
May 21, 2017

Conversation

mortenpi
Copy link
Member

Allows pretty URLs to be used in the HTML build, i.e. dir/page.md can be referenced as dir/page/ instead of the current dir/page.html. This behaviour is consistent with MkDocs and Sphinx, and has been on the roadmap.

This is done by storing the actual page in dir/page/index.html. It does mean that this can't be used for local / offline builds though.

Currently it has to enabled via the html_prettyurls option and is disabled by default. It should become the default for the deploy-to-gh-pages builds for packages, even though it will involve breaking existing links.

@tkelman I think this would also be nice to have for 0.6. This way we won't have to swap to .html links for a release and then back again (assuming we want this in the long term), potentially breaking quite a lot of references to Base docs. Also, links that were referring to the 0.5 docs should start working again. For Base we should enable this feature explicitly and only for the gh-pages builds.

WIP because some internal links are still not being generated correctly, code needs cleanup and more testing.

Example build: http://mortenpi.eu/Documenter.jl/pretty-urls-deploy/

@mortenpi mortenpi added this to the 0.11 milestone May 14, 2017
@tkelman
Copy link
Contributor

tkelman commented May 15, 2017

ok good idea, but it may be too late to make rc2. will have to see about final.

mortenpi added 2 commits May 19, 2017 20:18
In preparation of pretty URLs, make file extension mangling a
responsibility of the particular Writer module. Before the writing step,
all links should point to the original files, which generally have the
.md extension.

This only affects LatexWriter, since HTMLWriter already fixes .md links
and for the :markdown format nothing is actually done to the links in
the cross-referencing phase.
@mortenpi mortenpi changed the title RFC/WIP: Allow using pretty URLs Allow using pretty URLs May 19, 2017
@mortenpi
Copy link
Member Author

I should take another look at the code after a good night's sleep, but I believe it's done, and I don't think I have broken any old features even though I had to refactor a bit.

mortenpi added 2 commits May 21, 2017 16:47
If :html_prettyurls is enabled then every page gets written into an
index.html file under a separate directory. This yields cleaner URLs
when the page is hosted as a website (e.g. under gh-pages).

Specifically, a file `dir/file.md` can then be accessed via `dir/file/`
instead of `dir/file.html`.
@mortenpi mortenpi merged commit 7d7e1b5 into JuliaDocs:master May 21, 2017
@mortenpi mortenpi deleted the pretty-urls branch May 21, 2017 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants