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
691156c5ba
Use OS fs by default
...
Fixes #3032
2017-02-15 10:00:34 +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
John Feminella
298ebc37c2
hugolib: Add ability to sort by frontmatter parameters
2017-02-10 20:01:25 +07:00
Bjørn Erik Pedersen
2618cfbeaa
hugolib: Fix error for non-renderable HTML content with shortcodes
...
This commit re-introduces template lookup order that was accidently removed as
part of the template nonglobal refactoring.
Fixes #3021
2017-02-10 18:57:38 +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
John Feminella
962443ade8
hugolib: Correct repeated spelling errors in documentation
2017-02-09 10:48:07 +01:00
Bjørn Erik Pedersen
f404603340
Revert "hugolib: Add some baseof test variants"
...
This reverts commit d11f37d97c
.
Will have to look more closely into this.
See #2995
2017-02-07 02:04:12 +07:00
Bjørn Erik Pedersen
d11f37d97c
hugolib: Add some baseof test variants
...
See #2995
2017-02-07 00:01:28 +07:00
bogem
faba90ab96
helpers: Fix misspells
2017-02-04 22:28:36 +01:00
Bjørn Erik Pedersen
19aff029b1
hugolib: Skip rendering for the page tests
2017-02-04 23:15:07 +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
4ea4359ac1
hugolib: Avoid double-encoding of paginator URLs
...
Fixes #2177
2017-01-08 17:13:46 +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
magikstm
56c5eadc38
hugolib: Remove summary.go
...
Became obsolete after refactoring.
Fixes #2888 .
2017-01-06 16:40:51 +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
9f20e648b9
hugolib: Sync page collections with Site.Info on rebuild in watch mode
...
There is definitive potential for cleanup in this area, but this will have to do for now.
Fixes #2869
2017-01-05 20:57:24 +01:00
magikstm
01ee525f47
hugolib: Correct usage of "shortcode" in error messages
2017-01-05 15:40:28 +01:00
Daniel Lang
2127203ae3
Update documentation and test for sitemap template
2017-01-03 17:11:22 +01:00
Cameron Moore
cb63e87f8d
hugolib: Clean up a benchmark
2017-01-03 17:08:59 +01:00
Bjørn Erik Pedersen
5834efd5fd
hugolib: Add a taxonomy test case
2017-01-02 12:28:26 +01:00
David Kassa
09a0af94f5
Fix Appveyor Windows build and GitInfo path issue on Windows
2017-01-01 23:16:58 +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
d1b89f5c7c
hugolib: Use reflect.DeepEqual in tests
2016-12-27 11:19:25 +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
7d991ed89c
hugolib: Make template error messages more verbose
...
Fixes #2820
2016-12-26 14:52:31 +01:00
Bjørn Erik Pedersen
1881f60a16
hugolib: Add a test assertion for IsTranslated
...
See #2812
2016-12-21 10:17:05 +01:00
Bjørn Erik Pedersen
a3a67163f9
hugolib: Enable override of theme base template only
...
This commit fixes the base template lookup order to match the behaviour of regular templates.
```
1. <current-path>/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>.
2. <current-path>/baseof.<suffix>
3. _default/<template-name>-baseof.<suffix>, e.g. list-baseof.<suffix>.
4. _default/baseof.<suffix>
For each of the steps above, it will first look in the project, then, if theme is set,
in the theme's layouts folder.
```
Fixes #2783
2016-12-15 21:35:38 +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
e3d48760c9
hugolib: Fix comment
2016-12-06 09:57:05 +01:00
Bjørn Erik Pedersen
d4b9fa96f9
hugolib: Respect disableRSS
...
Fixes #2764
2016-12-06 09:32:14 +01:00
Bjørn Erik Pedersen
ba8a00a6f9
hugolib: Add regular content page count in publish summary
...
Fixes #2759
2016-12-03 17:42:45 +01:00
Bjørn Erik Pedersen
15622c80ee
hugolib: Remove superfluous assignment
2016-12-02 16:09:18 +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
Chase Adams
c87331ae84
hugolib: Fix rendered empty msg
...
Changes `%q` to `%s`. `%q` was safely escaping the `\` in windows so that it was printing `\\`.
2016-11-30 00:03:47 +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
Victor Kropp
dbb0c1cfc9
hugolib: Add shortcode for Instagram
2016-11-23 20:28:42 +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
Bjørn Erik Pedersen
0a0db9cd25
hubolib: Simplify map range
2016-11-23 16:46:16 +01:00
Bjørn Erik Pedersen
ff2498ee89
Remove ShowPlan
...
It is out of sync with reality, has some disabled tests, and the cost
of getting it up-to-date is too high to be worth it.
2016-11-23 16:35:49 +01:00
Bjørn Erik Pedersen
c8d4114171
hugolib: Add missing paginator test case
2016-11-23 10:44:35 +01:00
bogem
581291dc3b
hugolib: Omit type from declaration of var lang
...
Fix golint warning: hugolib/site.go:922:13: should omit type
*helpers.Language from declaration of var lang; it will be inferred from
the right-hand side
See #2014
2016-11-23 09:13:00 +01:00
bogem
32336e9ec6
hugolib: Camelcase ALL_CAPS vars and const in tests
...
See #2014
2016-11-23 09:13:00 +01:00
bogem
75e55cd06f
hugolib, source, tpl: Fix docs
...
See #2014
2016-11-23 09:13:00 +01:00
bogem
713f577a27
commands, hugolib: Unify case of config variable names
2016-11-22 23:43:55 +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
382582fcda
node to page: Re-add translations sort of regular pages
...
Was removed by mistake.
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
0eb5f54d30
node to page: Fix site pages sort
...
Updates #2297
2016-11-22 09:57:03 +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
f776af6c9b
node to page: Temporary set RSS date to zero
...
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
0bbdcf24fe
node to page: Render aliases before pages
...
Some sites, Hugo docs included, have faulty alias definitions that point
to itself or another real page. These will be overwritten in the next step.
This is how it behaves in Hugo 0.17, too.
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
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
88972b0d5b
node to page: Refactor the build process
...
To make it easier to follow and understand.
Both building and rebuilding now follow a four step flow:
1. Init
2. Process
3. Assemble
4. Render
And now there are only one Build method, used for both builds and rebuilds.
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
d3d3863c05
node to page: Add all nodes to sitemap
...
Updates #2297
Fixes #1303
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
7cc637e97a
node to page: Do not create section node for root
...
Because that will overwrite the home page, which is bad.
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
503fb29953
node to page: Get Rebuild up to speed
...
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
94ea12ebcf
node to page: Remove unused code
...
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
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
Bjørn Erik Pedersen
3b42640e3f
hugolib: Don't write zero-bytes files to disk
...
Fixes #2709
2016-11-20 14:59:21 +01:00
Tristan Rice
a49f838cd0
tpl: Add imageConfig function
...
Add imageConfig function which calls image.DecodeConfig and returns the height, width and color mode of the image. (#2677 )
This allows for more advanced image shortcodes and templates such as those required by AMP.
layouts/shortcodes/amp-img.html
```
{{ $src := .Get "src" }}
{{ $config := imageConfig (printf "/static/%s" $src) }}
<amp-img src="{{$src}}"
height="{{$config.Height}}"
width="{{$config.Width}}"
layout="responsive">
</amp-img>
```
2016-11-16 13:00:45 +01:00
Bjørn Erik Pedersen
4d4c7791ac
hugolib: Must update PathSpec on SiteInfo per language
2016-11-07 21:17:51 +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