Commit graph

276 commits

Author SHA1 Message Date
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 234273a5b5 Deprecate sourceRelativeLinks
Fixes #3028
Closes #3026
Closes #2891
Closes #2691
2017-02-11 16:51:22 +07:00
Bjørn Erik Pedersen 25bfa7e12f hugolib: Use the site's Tmpl for non-renderable pages 2017-02-10 10:44:35 +07: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 d6000a208c all: Refactor to nonglobal template handling
Updates #2701
2017-01-10 01:36:59 +01: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
Cameron Moore 3d058a936f hugolib: Allow arrays of arrays in frontmatter Params
Fixes #2752
2017-01-06 11:56:22 +01:00
Bjørn Erik Pedersen 6e0f326b9d hugolib: Deprecate Page.Now
Use `now` (template func).

See cabc6b3186
2017-01-01 13:10:36 +01:00
Bjørn Erik Pedersen 695be00c07 hugolib: Bump the current warning deprecations
Fixes #2836
2017-01-01 12:36:21 +01:00
Bjørn Erik Pedersen bcb3ef7413 hugolib: Fix preserveTaxonomyNames regressions
Fixes #2809
2016-12-28 13:44:55 +01:00
Bjørn Erik Pedersen 88b5bbd532 hugolib: Fix IsTranslated for "old" node types
The new logic for creating Page objects from old node types
didn't include itself in the translation logic, so
`IsTranslated` returned falsely false for sites with only two languages.

The `AllTranslations` method also returned too few pages in that case.

This commit fixes that.

Fixes #2812
2016-12-27 12:01:54 +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 2f026ab3f3 hugolib: Make RawContent raw again
This was a regression introduced in Hugo 0.17.

Fixes #2601
2016-12-01 17:29:49 +01:00
Bjørn Erik Pedersen 20d82a7a1b hugolib: Create the permalink once only 2016-11-27 19:25:28 +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 1f6e0de361 hugolib: Avoid repeated Viper loads of sectionPagesMenu
See #2728
2016-11-24 10:54:15 +01:00
Bjørn Erik Pedersen 4360452001 hugolib: Simplify 2016-11-23 18:32:17 +01:00
Bjørn Erik Pedersen f1ed89fec4 Revise the deprecation strategy
Git users and theme authors two Hugo releases to fix:

1. With a visible warning
2. Then with an ERROR that exits with -1

Fixes #2726
2016-11-23 17:26:13 +01:00
bogem dec1706ae0 commands, hugolib, parser, tpl: Use errors.New instead of fmt.Errorf 2016-11-22 23:43:55 +01:00
Bjørn Erik Pedersen e1da7cb320 Fix case issues with Params
There are currently several Params and case related issues floating around in Hugo.

This is very confusing for users and one of the most common support questions on the forum.

And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work:

`Params.myCamelCasedParam`

Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys.

But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`.

This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys.

This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling".

Tests are added for all the template engines: Go templates, Ace and Amber.

Fixes #2615
Fixes #1129
Fixes #2590
2016-11-22 17:33:52 +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 32fb1e6fac node to page: Need to append theme templates
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 a843d5d3bb node to page: Final TODO-fixes
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 99d11386a7 node to page: Fix the Page copy()
By embeding the init sync.Once var in a pointer so we can reset it when we copy the page.

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 9347084d61 node to page: Make Kind a string
Having a custom string type isn't worth it when it doesn't work
with `where`, `eq` etc.

Fixes #2689
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 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 80e453f114 node to page: Fix home target path on Windows
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 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
Bjørn Erik Pedersen e7d0bc8a74 Revert "Fix case issues with Params"
This reverts commit 239c75c7f8.

There is a ininite loop in there somewhere on my site that needs to be resolved.
2016-11-22 09:42:11 +01:00
Bjørn Erik Pedersen 239c75c7f8 Fix case issues with Params
There are currently several Params and case related issues floating around in Hugo.

This is very confusing for users and one of the most common support questions on the forum.

And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work:

`Params.myCamelCasedParam`

Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys.

But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`.

This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys.

This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling".

Tests are added for all the template engines: Go templates, Ace and Amber.

Fixes #2615
Fixes #1129
Fixes #2590
2016-11-22 09:04:38 +01:00
Albert Nigmatzianov 85a2d81e3c commands, tpl: Get rid of repeating viper accesses
* all: Delete some blank lines
* commands, tpl: Get rid of repeating viper accesses
2016-11-07 00:10:32 +01:00
Bjørn Erik Pedersen e8380e612f Add GitInfo
This commit adds a `GitInfo` object to `Page` if `EnableGitInfo` is set.

It then also sets `Lastmod` for the given `Page` to the author date provided by Git.

The Git integrations should be fairly performant, but it adds "some time" to the build, somewhat depending on the Git history size.

If you want, you can run without during development and turn it on when deploying to the live server: `hugo --enableGitInfo`.

Fixes #2102
2016-11-01 23:04:12 +01:00
Prashant Karmakar 186db7cd7a Fix page names that contain dot
changes:
    - in hugolib/page.go, `func permalink` and `func TargetPath`
      Fixed the attempt to *replace* the extension of something
      that was *already* a basename.
    - in source/file.go, `func NewFile`
      added check for allowed languages before translating filename

Fixes #2555
2016-11-01 14:18:24 +01:00
Joonatan Saarhelo 89e3125664 Get rid of the rawContentCopy field of the Page struct
It is not needed, because it is only used to store temporary data during `preparePagesForRender`.
2016-10-25 20:40:32 +02:00