Commit graph

414 commits

Author SHA1 Message Date
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 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 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 503fb29953 node to page: Get Rebuild up to speed
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 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
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
Bjørn Erik Pedersen 72156e403c hugolib: Simplify range 2016-11-05 17:28:13 +01:00
Bjørn Erik Pedersen 6a3d1037b3 Fix RSS Title regression
And add tests to make sure it doesn't happen again.

Fixes #2645
2016-10-28 14:46:33 +02:00
Albert Nigmatzianov f21e2f25c9 all: Unify case of config variable names
All config variables starts with low-case and uses camelCase.

If there is abbreviation at the beginning of the name, the whole
abbreviation will be written in low-case.
If there is abbreviation at the end of the name, the
whole abbreviation will be written in upper-case.
For example, rssURI.
2016-10-24 20:56:00 +02:00
Bjørn Erik Pedersen a10b2cd372 Avoid reading from Viper for path and URL funcs
The gain, given the "real sites benchmark" below, is obvious:

```
benchmark           old ns/op       new ns/op       delta
BenchmarkHugo-4     14497594101     13084156335     -9.75%

benchmark           old allocs     new allocs     delta
BenchmarkHugo-4     57404335       48282002       -15.89%

benchmark           old bytes       new bytes      delta
BenchmarkHugo-4     9933505624      9721984424     -2.13%
```

Fixes #2495
2016-10-24 13:45:30 +02:00
Bjørn Erik Pedersen 58f31d2769 Consolidate the Param methods
Maps in Viper, Hugo's config backing store, is now properly lower-cased not just on top level, the current situation.

While this is mostly a good thing, as you don't need to know the original casing to look up a value, it will be breaking for people doing direct lookups in the ´Site.Params` map.

We will try to find a solution to this "breakage", but the recommended method to get params values is via the `.Param` methods.

This method is now implemented on `Node`, `Page` and `Site` and is case-insensitive:

* Use `.Param "someKey" ` if you want page param with fall back to site param if not found on page.
* Use `.Site.Param "someKey"` to get a site param

See #2590
2016-10-17 19:36:58 +02:00
Nate Finch 10a773cde7 Implement support for alias templates
This change adds a canonical alias.html template that is used for page
redirects, and passes the page as data to the template under .Page

Fixes #2533
Closes #2576
2016-10-15 15:25:05 +02:00
Albert 8fa871a05f all: Remove dead code 2016-10-13 13:51:16 +02:00
Bjørn Erik Pedersen 998034faad Log on error in translation file
Fixes #2562
2016-10-12 16:54:29 +02:00
Bjørn Erik Pedersen bf0dfa3e2d Fix URL in multilanguage sitemap index
Fixes #2509
2016-09-30 16:24:57 +02:00
Bjørn Erik Pedersen a0167d838e Fix leaky goroutine
By making the err chan buffered so both go routines can return.

Also make sure that any errors are logged.

Fixes #2488
2016-09-23 19:04:19 +02:00
Bjørn Erik Pedersen 4a79fa0c33 Revert the "standardize author data"
There were some breaking changes etc. that is too late to fix for 0.17.

Let us think this through and add proper author support for Hugo 0.18.

Fixes #2464

Revert "docs: Add documentation for author profiles"

This reverts commit b6673e5309.

Revert "Add First Class Author Support"

This reverts commit cf978c0649.
2016-09-18 19:16:39 +02:00
Derek Perkins cf978c0649 Add First Class Author Support
Closes #1850
2016-09-17 00:49:24 +02:00
Bjørn Erik Pedersen b86a605bfb Make paginate settings configurable per language
Fixes #2449
2016-09-15 09:32:52 +02:00
Bjørn Erik Pedersen a7dc3c082e Support site menu per language
Fixes #2434
2016-09-12 20:59:03 +02:00
Bjørn Erik Pedersen ef3c4a56d8 Fix reload dir matching in theme
Fixes #2430
2016-09-11 20:00:38 +02:00
Bjørn Erik Pedersen 364e69ab7f Handle symlink change event
Hugo 0.16 announced support for symbolic links for the root folders, /content, /static etc., but this got broken pretty fast.

The main problem this commit tries to solve is the matching of file change events to "what changed".

An example:

ContentDir: /mysites/site/content where /mysites/site/content is a symlink to /mycontent

/mycontent:

/mypost1.md
/post/mypost2.md

* A change to mypost1.md (on OS X) will trigger a file change event with name "/mycontent/mypost1.md"
* A change to mypost2.md gives event with name "/mysites/site/content/mypost2.md"

The first change will not trigger a correct update of Hugo before this commit. This commit fixes this by doing a two-step check:

1. Check if "/mysites/site/content/mypost2.md" is within /mysites/site/content
2. Check if  "/mysites/site/content/mypost2.md" is within the real path that /mysites/site/content points to

Fixes #2265
Closes #2273
2016-09-11 20:00:38 +02:00
Bjørn Erik Pedersen 43bf9ed38e Redirect to root when DefaultContentLanguageInSubdir = false
Fixes #2422
2016-09-09 17:42:02 +02:00
Bjørn Erik Pedersen 4df86a703a Fix paginator counter on x86-32
Atomic operations with 64 bit values must be aligned for 64-bit on x86-32.

According to the spec:

"The first word in a global variable or in an allocated struct or slice can be relied upon to be 64-bit aligned."

The above wasn't enough for the `paginationPageCount` on `SiteInfo`, maybe due to how `SiteInfo` is embedded.

This commit adds a 4 byte padding before the `uint64` that creates the correct alignment.

Fixes #2415
2016-09-09 14:31:49 +02:00
Bjørn Erik Pedersen ccb3040ad4 Fix pagination page counter on 32 bit
Updates #2415
2016-09-08 17:18:11 +03:00
Bjørn Erik Pedersen 35d2eac490 Fix go vet 1.7 issues
Updates #2309
2016-09-06 18:32:21 +03:00
Bjørn Erik Pedersen dc3618abcd Make sure the 404 node has .Data.Pages
Updates #2309
2016-09-06 18:32:21 +03:00