hugolib: Refactor/-work the permalink/target path logic
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 9 Mar 2017 18:19:29 +0000 (19:19 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 27 Mar 2017 13:43:56 +0000 (15:43 +0200)
commit6bf010fed432e5574e19fd2946ee6397d895950e
tree75282ccbd526adc8dba62f9392db282b3bcec49f
parentc8fff9501d424882a42f750800d9982ec47df640
hugolib: Refactor/-work the permalink/target path logic

This is a pretty fundamental change in Hugo, but absolutely needed if we should have any hope of getting "multiple outputs" done.

This commit's goal is to say:

* Every file target path is created by `createTargetPath`, i.e. one function for all.
* That function takes every page and site parameter into account, to avoid fragile string parsing to uglify etc. later on.
* The path creation logic has full test coverage.
* All permalinks, paginator URLs etc. are then built on top of that same logic.

Fixes #1252
Fixes #2110
Closes #2374
Fixes #1885
Fixes #3102
Fixes #3179
Fixes #1641
Fixes #1989
26 files changed:
helpers/pathspec.go
helpers/pathspec_test.go
helpers/url.go
hugolib/embedded_shortcodes_test.go
hugolib/hugo_sites.go
hugolib/hugo_sites_build.go
hugolib/hugo_sites_build_test.go
hugolib/node_as_page_test.go
hugolib/page.go
hugolib/page_output.go
hugolib/page_paths.go [new file with mode: 0644]
hugolib/page_paths_test.go [new file with mode: 0644]
hugolib/page_test.go
hugolib/pagination.go
hugolib/pagination_test.go
hugolib/site.go
hugolib/site_output.go
hugolib/site_output_test.go
hugolib/site_render.go
hugolib/site_test.go
hugolib/site_writer.go
hugolib/site_writer_test.go
hugolib/taxonomy_test.go
hugolib/testhelpers_test.go
output/outputType.go
output/outputType_test.go