Commit graph

40 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
6bf010fed4 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
2017-03-27 15:43:56 +02:00
Anton Staaf
c950699907 hugolib: Populate the taxonomy term Pages list
Previously this was left empty, but it is very handy to have a list
of term pages for a given taxonomy.  This list can now be paginated
like other page lists.  It makes it possible to render summary
content from each terms index page for instance.  It also makes it
possible to sort the term pages in the same way that other page
lists can be sorted.  An RSS feed is now generated for
KindTaxonomyTerm pages as well.

This also fixes a bug in HugoSites.createMissingPages.  Previously
it would only check for existing KindTaxonomyTerm pages if the
taxonomy had any terms defined.  So for a taxonomy with no terms
but a taxonomy terms page it would generate a second empty terms
page.
2017-03-05 21:24:14 +01:00
Anton Staaf
22c89dcb6c hugolib: Fix HugoSites.createMissingPages
Previously it would only check for existing KindTaxonomyTerm pages
if the taxonomy had any terms defined.  So for a taxonomy with no terms
but a taxonomy terms page it would generate a second empty terms page.
2017-03-04 21:37:52 +01:00
Bjørn Erik Pedersen
23f5b9ac4e hugolib: Fix broken test
See #2977
2017-03-01 18:44:30 +01:00
Bjørn Erik Pedersen
07ab7ae3d2 hugolib: More test helper cleanup 2017-02-18 07:53:25 +01:00
Bjørn Erik Pedersen
ed847ed93d hugolib: Test helper cleanup 2017-02-17 20:52:50 +01:00
Bjørn Erik Pedersen
93ca7c9e95 all: Refactor to nonglobal Viper, i18n etc.
This is a final rewrite that removes all the global state in Hugo, which also enables
the use if `t.Parallel` in tests.

Updates #2701
Fixes #3016
2017-02-17 17:15:26 +01:00
Bjørn Erik Pedersen
c71e1b106e all: Refactor to nonglobal file systems
Updates #2701
Fixes #2951
2017-02-04 11:37:25 +07:00
Bjørn Erik Pedersen
45e3ed517a all: Refactor to non-global logger
Note that this looks like overkill for just the logger, and that is correct,
but this will make sense once we start with the template handling etc.

Updates #2701
2017-01-07 17:06:35 +01:00
Bjørn Erik Pedersen
5834efd5fd hugolib: Add a taxonomy test case 2017-01-02 12:28:26 +01:00
Bjørn Erik Pedersen
bcb3ef7413 hugolib: Fix preserveTaxonomyNames regressions
Fixes #2809
2016-12-28 13:44:55 +01:00
Cameron Moore
17f851780c hugolib: Fix redundant URL file extension on taxonomy terms pages
Fixes #2819
2016-12-27 11:18:47 +01:00
Bjørn Erik Pedersen
83c6806576 Fix menu URL for node type pages
By delaying the menu assembly.

Fixes #2770
2016-12-11 16:16:24 +01:00
Bjørn Erik Pedersen
c38bfda43b hugolib: Fix regressions with uglyURLs
Fixes #2734
2016-11-27 14:36:17 +01:00
Bjørn Erik Pedersen
976f8f84bf node to page: Fixe index page translation issues
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
7e81971b46 node to page: Don't repeat the RSS title if it is the same
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
28031b0897 node to page: Only return regular pages in home.Data.Pages
Returning all types is both confusing and too breaking.

All page types can be fetched in .Site.Pages.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
62e9e7e6ba node to page: Misc. TODO-fixes
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
524eb16686 node to page: Handle URLs
This includes removing the error return value from Permalink and RelPermalink.

We ignore that error all over the place, so we might as well remove it.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
c8d3124dde node to page: Remove Node
And misc. TODO-fixes

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
9fba2a30a9 node to page: Rename PageType to Kind
And embed that on Page.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
96f71141bd node to page: Export GetPage to the templates
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
487b210fb8 node to page: Handle Date and Lastmod
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
c80308e6b3 node to page: Add Pages to Page
As an alias to .Data.Pages for home page etc.

Also renamte NodeType to PageType and make it a string so it can be used in `where`.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
063b78d2ec node to page: Make Nodes into Pages
* `.Site.Pages` now contains all page types, including sections etc.
* `.Data.Pages` will also contain "node type" pages where relevant.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
640b8bed21 node to page: Handle sections with only _index.md
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
2d91b17c04 node to page: Handle aliases on home page etc.
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
7cb0e34dce node to page: Handle menus on home page etc.
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
ecedc85cb7 node to page: Handle taxonomies on home page etc.
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
bde1bfd34a node to page: Handle aliases, 404, robots.txt, sitemap
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
ec2d502b4f node to page: Handle translations
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
698b994f71 node to page: Fix the page collections
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
c175407fa4 node to page: Use _index as identificator for the list nodes
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
3ff25b37a3 node to page: Handle RSS
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
75c38071d8 node to page: Create pages for nodes without content
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
f8bda16e15 node to page: Handle taxonomy terms
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
3737c9bcb3 node to page: Handle taxonomy lists
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
c2f3cb2d7a node to page: Handle sections
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
734b6508a1 node to page: Handle home
With refactored paginator handling.

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
e371ac0b6f node to page: Basic outline
Updates #2297
2016-11-22 09:57:03 +01:00