Commit graph

1295 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 19de4476d8 hubolib: Remove the regular page restriction from .Site.GetPage
See #2844
2017-05-26 21:31:45 +03:00
Bjørn Erik Pedersen b5b41c4468 hugolib: Refine allKindsInPages 2017-05-26 10:51:17 +03:00
Bjørn Erik Pedersen 612f6e3afe hugolib: Fix ref/relref issue with duplicate base filenames
This commit also makes that function 80x faster.

Fixes #2507
2017-05-26 10:42:45 +03:00
Bjørn Erik Pedersen 50d11138f3 hugolib: Add a cache to GetPage
Looks to be slightly slower with the low number of section pages, but the 1000 regular pages seem to add value.

```
benchmark                     old ns/op     new ns/op     delta
BenchmarkGetPage-4            97.7          145           +48.41%
BenchmarkGetPageRegular-4     7933          161           -97.97%

benchmark                     old allocs     new allocs     delta
BenchmarkGetPage-4            0              0              +0.00%
BenchmarkGetPageRegular-4     0              0              +0.00%

benchmark                     old bytes     new bytes     delta
BenchmarkGetPage-4            0             0             +0.00%
BenchmarkGetPageRegular-4     0             0             +0.00%
```
2017-05-26 10:42:45 +03:00
Bjørn Erik Pedersen e0c2e79820 hugolib: Support regular pages in .Site.GetPage
Fixes #2844
2017-05-26 10:42:45 +03:00
Bjørn Erik Pedersen 8b49c3a175 hugolib: Enable leaktest
See #3082
2017-05-23 20:40:20 +03:00
Bjørn Erik Pedersen fbb78b89df hugolib: Speed up GetPage
When we know to look into the index pages collection, do that:

```
benchmark              old ns/op     new ns/op     delta
BenchmarkGetPage-4     51483         7072          -86.26%

benchmark              old allocs     new allocs     delta
BenchmarkGetPage-4     71             71             +0.00%

benchmark              old bytes     new bytes     delta
BenchmarkGetPage-4     2648          2648          +0.00%
```

This commit also returns an error if .Site.GetPage is called with the regular Page Kind, as that is currently not supported.

Fixes #3503
2017-05-23 15:18:26 +03:00
Bjørn Erik Pedersen 6c560288a6 hugolib: Add BenchmarkGetPage 2017-05-23 12:10:15 +03:00
Bjørn Erik Pedersen e682fcc622 hugolib: Fix RSSLink vs RSS Output Format
Fixes #3450
2017-05-17 22:14:31 +03:00
Bjørn Erik Pedersen 6e2f2dd8d3 hugolib: Fix output formats override when no outputs definition given
A common use case for this is to redefine the built-in output format `RSS` to give it a different URL.

Before this commit, that was not possible without also providing an `outputs` definition.

Fixes #3447
2017-05-17 19:00:15 +03:00
Bjørn Erik Pedersen af72db806f hugolib: Handle shortcode per output format
This commit allows shortcode per output format, a typical use case would be the special AMP media tags.

Note that this will only re-render the "overridden" shortcodes and only  in pages where these are used, so performance in the normal case should not suffer.

Closes #3220
2017-05-13 22:44:15 +03:00
Bjørn Erik Pedersen e951d65771 hugolib: Handle any errors in processShortcodes 2017-05-13 22:44:15 +03:00
Bjørn Erik Pedersen 2bcbf10400 hugolib: Prepare render per output format
See #3220
2017-05-13 22:44:15 +03:00
Bjørn Erik Pedersen 1e4d082cf5 hubolib: Refactor site rendering with an "output format context"
Fixes #3397
2017-05-13 22:44:15 +03:00
Bjørn Erik Pedersen 544f0a6394 hugolib: The deprecated Extension, Now and TargetPath will now ERROR 2017-05-10 20:05:52 +02:00
Bjørn Erik Pedersen 5794a265b4 commands, hugolib: Deprecate disable404, disableRSS, disableSitemap, disableRobotsTXT
Use disableKinds instead.

Fixes #3345
2017-05-10 20:00:08 +02:00
Bjørn Erik Pedersen ebf677a583 hubolib: Embed Page in WeightedPage
People can still say `.Page`, but by embedding it `WeightedPages` can be used interchangeably with `Pages` in templates.

Fixes #3435
2017-05-09 23:58:25 +02:00
Bjørn Erik Pedersen 58d9cbd31b hugolib: Improve shortcode error message 2017-05-09 18:43:48 +02:00
Chase Adams 42f4ce15a9 hugolib: Add default config for ignoreFiles 2017-05-06 09:41:24 +02:00
Bjørn Erik Pedersen 8a49c0b3b8 tpl/collections: Make it a package that stands on its own
See #3042
2017-05-01 15:13:41 +02:00
Cameron Moore de7c32a1a8 tpl: Add template function namespaces
This commit moves almost all of the template functions into separate
packages under tpl/ and adds a namespace framework.  All changes should
be backward compatible for end users, as all existing function names in
the template funcMap are left intact.

Seq and DoArithmatic have been moved out of the helpers package and into
template namespaces.

Most of the tests involved have been refactored, and many new tests have
been written.  There's still work to do, but this is a big improvement.

I got a little overzealous and added some new functions along the way:

- strings.Contains
- strings.ContainsAny
- strings.HasSuffix
- strings.TrimPrefix
- strings.TrimSuffix

Documentation is forthcoming.

Fixes #3042
2017-04-30 10:56:38 +02:00
Mitchell Cohen 154e18ddb9 Render 404 in default language only
This prevents 404.html from being re-rendered for each site.

Fixes #3075
2017-04-30 10:40:37 +02:00
Bjørn Erik Pedersen 8d0917af0a hubolib: Narrow a test assertion 2017-04-27 13:00:24 +02:00
Bjørn Erik Pedersen fea4fd86a3 hugolib: Avoid index.md in /index/index.html
Hugo 0.20 broke some sites that grouped their blog post and images together in subfolders.

This commit re-introduces that behaviour:

* If the file base name resolves to the same as the base name for the output type (i.e. "index" for HTML), the user probably meant it, so we treat that as an `uglyURL`, i.e. `my-blog-post-1.md`=> `/my-blog-post-1/index.html`
* The main use case for this is to group blog post and images together.
* Note that for the top level folder there will be a potential name conflict with a `section` `index.html` (if enabled)
* This issue will not be relevant for subfolders in sections
* Hugo will soon add support for nested sections, but we will have to find a way to separate them from the rest (`/content/_mysubsection` maybe).

Fixes #3396
2017-04-27 09:50:13 +02:00
Bjørn Erik Pedersen 5ad2f17693 hugolib: Make missing GitInfo a WARNING
And not an ERROR.

Fixes #3376
2017-04-26 11:03:12 +02:00
Bjørn Erik Pedersen 7f6430d84d Automate the Hugo release process
This commit adds a work flow aroung GoReleaser to get the Hugo release process automated and more uniform:

* It can be run fully automated or in two steps to allow for manual edits of the relase notes.
* It supports both patch and full releases.
* It fetches author, issue, repo info. etc. for the release notes from GitHub.
* The file names produced are mainly the same as before, but we no use tar.gz as archive for all Unix versions.
* There isn't a fully automated CI setup in place yet, but the release tag is marked in the commit message with "[ci deploy]"

Fixes #3358
2017-04-24 11:08:56 +02:00
Bjørn Erik Pedersen 0e87b18b66 hugolib: Fix handling of zero-length files
This was a regression in Hugo 0.20. This commit makes sure that zeron-length files are not rendered to file.

Fixes #3355
2017-04-23 22:46:01 +02:00
Albert Nigmatzianov e98f885b8a hugolib: Prevent decoding pageParam in common cases 2017-04-22 22:40:20 +02:00
xofyarg b5b6e81c02 hugolib: Ignore non-source files on partial rebuild
Partial rebuild does not have the same logic as normal rebuild on
selecting which file to build. This change makes it possible to
share the file select logic between two kinds of build.

Fix #3325.
2017-04-22 22:38:54 +02:00
Bjørn Erik Pedersen ab692e73de hugolib: Log WARNING only on unknown /data files
Fixes #3361
2017-04-18 18:47:37 +02:00
Bjørn Erik Pedersen 6d2ea0f7d7 hugolib, output: Do not lower case template names
This regression was introduced in Hugo 0.20.

Fixes #3333
2017-04-12 21:40:55 +02:00
Bjørn Erik Pedersen 45c7452668 hugolib: Must recreate Paginator on live-reload
The structure may potentially have changed, and then it fails.

Fixes #3315
2017-04-12 21:15:51 +02:00
Bjørn Erik Pedersen e765b43e2b hugolib: Avoid recreating the Paginator on copy
See #3315
2017-04-12 21:15:51 +02:00
Bjørn Erik Pedersen 3b67759495 hugolib: Avoid processing the same notify event twice
On `macOS`, at least, we've seen multiple WRITE events for same file, and no need to do the same job twice.
2017-04-12 21:15:51 +02:00
Bjørn Erik Pedersen 9ec00725b7 hugolib: Final fix of rssURI deprecation
Fixes #3319
2017-04-10 21:26:55 +02:00
Bjørn Erik Pedersen cfd3af8e69 hugolib: Only show rssUri deprecation WARNING if it is actually set
Fixes #3319
2017-04-10 17:54:55 +02:00
Bjørn Erik Pedersen e73a35dea5 hugolib: Remove unused line 2017-04-08 18:04:12 +02:00
Bjørn Erik Pedersen c9731b2c2a hugolib: Delay deletion of Page.Now()
Looking at the state of the themes, it will be too painful to log ERROR now.
2017-04-08 18:02:36 +02:00
Bjørn Erik Pedersen 2874fc75ce hugolib, output: Add NotAlternative to OutputFormat
To make sure CSS and similar does not appear in the AlternativeOutputFormats list.
2017-04-08 11:21:12 +02:00
Bjørn Erik Pedersen 9e69a92e85 hugolib: Deprecate rssURI 2017-04-08 10:46:13 +02:00
Bjørn Erik Pedersen 7b2e1b0be9 hubolib: Do not add missing trailing slash to command line baseURL
This makes it consistent with how it behaves when it's set in config.toml.

This commit also unifies BaseURL in Site.Info so we now have one source for this value.

Fixes #3262
2017-04-07 20:18:31 +02:00
Bjørn Erik Pedersen 7ad721fd78 hugolib: Add .Site.Params.mainSections
Fixes #3206
2017-04-07 13:03:34 +02:00
Bjørn Erik Pedersen 5714531f34 hugolib: Only do link transforms etc. on HTML type of pages
See #2828
2017-04-07 11:02:23 +02:00
Bjørn Erik Pedersen 9580872459 hugolib: Update deprecation vs Hugo 0.20
Fixes #3271
2017-04-07 10:48:09 +02:00
Bjørn Erik Pedersen c4a1165587 all: Handle all errors
As reported by `errcheck`.
2017-04-06 20:35:26 +02:00
Bjørn Erik Pedersen 1425587193 hugolib: Add optional outputFormat to Ref/RelRef
Fixes #3224
2017-04-04 23:09:01 +02:00
Bjørn Erik Pedersen a883948c4f Register all media types when in server mode
Fixes #3274
2017-04-04 18:05:19 +02:00
Bjørn Erik Pedersen 7da1b65968 all: Use the configured output types to resolve template type
Closes #320
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen 868f89d5c6 hugolib: Improve render error handling
Catch and return the "template not found" error earlier.
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen 10ff2f31a6 hugolib: Read media types and output formats from site config
Closes #3222
Closes #3223
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen c9aee467d3 output: Add output formats decoder
And clean up the output package.
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen 8b5b558bb5 tpl: Rework to handle both text and HTML templates
Before this commit, Hugo used `html/template` for all Go templates.

While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc.

This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use.

A couple of notes:

* The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work.
* Ambiguous types will fall back to HTML.
* Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials.
* Shortcode templates are, by definition, currently HTML templates only.

Fixes #3221
2017-04-02 23:13:10 +02:00
Albert Nigmatzianov 27610ddd01 hugolib: Don't ignore errors from applyDepsIfNeeded 2017-04-02 18:43:32 +02:00
Albert Nigmatzianov 6b29bccfee hugolib, i18n: Update tests with flat format and TOML files 2017-04-02 18:43:32 +02:00
Bjørn Erik Pedersen 7eb71ee064 Revert "tpl: Rework to handle both text and HTML templates"
Will have to take another stab at this ...

This reverts commit 5c5efa03d2.

Closes #3260
2017-04-02 14:20:34 +02:00
Bjørn Erik Pedersen c97dae40d9 hugolib: Use Page Kind in template errors to prevent log spam
Having the content page name in the log key for the distinct error logger isnt't very usable when you have an error in a commonly used partial.

Using the Page Kind reduces the amount of log entries. Here is an example from an error in the partial menu.html, used in all the page templates:

```
Started building sites ...
ERROR 2017/04/02 12:19:43 Error while rendering "page": template: /Users/bep/sites/bepsays.com/layouts/_default/single.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/single.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "section": template: /Users/bep/sites/bepsays.com/layouts/_default/section.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/section.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "taxonomy": template: /Users/bep/sites/bepsays.com/layouts/_default/list.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/list.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "home": template: /Users/bep/sites/bepsays.com/layouts/index.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/index.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "404": template: 404.html:2:3: executing "404.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
Built site for language nn:
```
Which is pretty good.
2017-04-02 12:22:54 +02:00
Bjørn Erik Pedersen 5c5efa03d2 tpl: Rework to handle both text and HTML templates
Before this commit, Hugo used `html/template` for all Go templates.

While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc.

This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use.

A couple of notes:

* The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work.
* Ambiguous types will fall back to HTML.
* Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials.
* Shortcode templates are, by definition, currently HTML templates only.

Fixes #3221
2017-04-02 11:37:30 +02:00
Bjørn Erik Pedersen 87b3cd4655 hugolib, helpers: Reduce log level to WARN on .Render for non-regular pages
We will eventually support all types in the Render method.
2017-03-29 08:08:45 +02:00
Bjørn Erik Pedersen af55ec7661 hugolib, output: Gofmt 2017-03-28 01:18:15 +02:00
Bjørn Erik Pedersen 930a3df1b7 hugolib, output: Restrict Render to regular Pages
Using it for list pages doesn't work and has potential weird side-effects.

The user probably meant to range over .Site.ReqularPages, and that is now marked clearly in the log.
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen e49a2b83ad hugolib: Fix Render layouts for list pages 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 9a0aa5fdbe hugolib: Wrap pageOutput create in sync.Once 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 0aaf3c56a5 hugolib: Fix panic for Permalink in 404 etc. templates 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 09c88e84d1 output: Rename HTMLType etc. to HTMLFormat 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 24c1770288 hugolib: Revise paginator alias path handling 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen b7ed67d425 hugolib: More TODO fixes 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 3cd97951f1 hugolib, layout: Consolidate RSS template handling 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen ee75e2999b Remove the now superflous defaultExtension
And some other unsed fields and methods.
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 15b64d51da all: Propagate baseURL error to the callers 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 148fedd227 hugolib, tplimpl: Use OutputFormats to create atom links 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen ec01c3a7f0 hugolib: Add 404 test 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 5761b93c96 hugolib, output: Fix RSSLink vs output formats
And remove the now superflous setPageURLs method.
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 87188496fb hugolib, output: Handle aliases for all HTML formats 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 0c4701f0ef hugolib: Update site stats to take output formats into account 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen d851d6b98f Add custom protocol support in Permalink 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen dbb83f925a hugolib: Read default output formats from site config 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 4aaed87dd9 hugolib, media: Make the MediaType available to the templates 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen c7dbee2321 hugolib, output: Add Rel to the output format
To make it super-easy to create rel-links.
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 1b2be5e878 hugolib: Add OutputFormats with permalinks to Page 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen baa29f6534 output: Rework the base template logic
Extract the logic to a testable function and add support for custom output types.

Fixes #2995
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen c7c6b47ba8 hubolib: Pick layout per output format 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 08fa2b1124 hugolib: Fix layout lookup order for Render func
Will have to fix this in a better way later in relation to the non-renderable pages.

But this commit brings the Hugo Benchmark down to "only slightly slower" than master.

```
benchmark           old ns/op       new ns/op       delta
BenchmarkHugo-4     10074504521     10071236251     -0.03%

benchmark           old allocs     new allocs     delta
BenchmarkHugo-4     43623091       49271859       +12.95%

benchmark           old bytes      new bytes      delta
BenchmarkHugo-4     9468322704     9725848376     +2.72%
```

Which is something we can work with.
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 6178238a0b output: Speed up layout calculations
```
BenchmarkLayout-4     4883          497           -89.82%

benchmark             old allocs     new allocs     delta
BenchmarkLayout-4     18             1              -94.44%

benchmark             old bytes     new bytes     delta
BenchmarkLayout-4     1624          32            -98.03%
```
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen df95383914 hugolib: Speed up URL handling 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen a49bf8707b hugolib: Remove siteWriter 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen d76e5f36b4 hugolib: Pull all alias handling into one file 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen ad8cea87f3 Refactor layout resolve to a descriptor/adapter pattern 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 4c2abe0015 Rename OutputType to OutputFormat 2017-03-27 15:43:56 +02:00
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
Bjørn Erik Pedersen c8fff9501d Implement the first generic JSON output testcase 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 3ec5fc3504 hugolib, output: Incorporate suffix and type in layout resolve
And remove some now superflous and hard to maintain tests.
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen f091fc23ed hugolib: Add basic setup for output def per Kind 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 03122e51fa hugolib: Revert to using Page as the render chan type
Changing it to PageOutput was a mistake. You may think that the increased parallelism should be a good thing.

But not so much with the increased lock contention and more complex concurrency model.
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen e5200ddaa4 hugolib: Remove the copying in the renderRSS 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen a8244658f7 hugolib: Put back taxonomy term paginator logic lost in rebase 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 50c64415aa hugolib, output: Add theme logic to LayoutHandler 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 348834d017 hugolib: Add a PageOutput wrapper for rendering 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 254cd89c8e hugolob: A first incorporation of output types in rendering 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 10de077164 hugolib: Use the new layout logic in Page 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen d3d2c63dd9 output: Add output type 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen c4989c39f1 Add MediaType and a crude implementation
See #2828
2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 17b21e0af1 hugolib: Correctly identify "my_index_page.md"
The above example was earlier identified as a section page and not a regular page.

Fixes #3234
2017-03-25 19:57:01 +01:00
Bjørn Erik Pedersen 2f2ea42c09 hugolib: Fix reloading corner cases for shortcodes
This commit fixes two different, but related issues:

1) Live-reload when a new shortcode was defined in the content file before the shortcode itself was created.
2) Live-reload when a newly defined shortcode changed its "inner content" status.

This commit also improves the shortcode related error messages to include the full path to the content file in question.

Fixes #3156
2017-03-11 20:21:06 +01:00
Cameron Moore f039e3be9e parser: Refactor frontmatter parser and add tests
Lots of cleanups here:

- Refactor InterfaceToConfig and InterfaceToFrontMatter to use io.Writer.
- Simplify InterfaceToFrontMatter by wrapping InterfaceToConfig.
- Export FrontmatterType since we return it in DetectFrontMatter.
- Refactor removeTOMLIdentifier to avoid blindly replacing "+++".
- Update HandleJSONMetaData to return an empty map on nil input.
- Updates vendored goorgeous package and test for org-mode frontmatter.
- Add tests and godoc comments.

Coverage for parser package increased from 45.2% to 85.2%.
2017-03-11 17:52:25 +01:00
Cameron Moore ddc8cc0082 hugolib: Clean up redundant frontmatter error logging
Fixes #3157
2017-03-10 23:22:43 +01:00
Cameron Moore fe41bd61bb hugolib: Default rssLimit to unlimited
Fixes #3145
2017-03-10 21:27:45 +01:00
Albert Nigmatzianov 48120ccfd2 all: Fix some govet complaints 2017-03-09 14:18:12 +01:00
Bjørn Erik Pedersen a2a8a651f7 hugolib: Don't report taxonomy count if disabled 2017-03-08 14:20:17 +01:00
Albert Nigmatzianov 4bfa189031 hugolib: Remove unnecessary params
Found by github.com/mvdan/unparam
2017-03-08 12:28:56 +01: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
Bjørn Erik Pedersen 6c5ef71368 hugolib: Add a temporary workaround for page.copy() data race
See ##3129
2017-03-05 15:41:58 +01:00
Bjørn Erik Pedersen e52e2a70e5 hugolib, target: Rework/move the target package
This relates to #3123.

The interfaces and types in `target` made sense at some point, but now this package is too restricted to a hardcoded set of media types.

The overall current logic:

* Create a file path based on some `Translator` with some hardcoded logic handling uglyURLs, hardcoded html suffix etc.
* In in some cases (alias), a template is applied to create the alias file.
* Then the content is written to destination.

One could argue that it is the last bullet that is the actual core responsibility.

This commit fixes that by moving the `hugolib`-related logic where it belong, and simplify the code, i.e. remove the abstractions.

This code will most certainly evolve once we start on #3123, but now it is at least possible to understand where to start.

Fixes #3123
2017-03-04 23:33:35 +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 5a94e4cfb9 hugolib: Add section template baseof test case
Closes #2995
See #3116
2017-03-02 13:52:08 +01:00
Bjørn Erik Pedersen 8203fc5923 hugolib: Add /layouts/SECTION/list.html to template lookup
Fixes #3116
2017-03-02 10:08:37 +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 9671162a22 hugolib: Make sure that empty terms lists are still created
Fixes #2977
2017-03-01 17:07:38 +01:00
Bjørn Erik Pedersen cc15864744 hugolib: Only return RSSLink when RSS is available
Fixes #1302
2017-03-01 12:30:41 +01:00
Bjørn Erik Pedersen 0b91053c9f hugolib: Only consider regular pages in Prev/Next
Fixes #3108
2017-02-28 09:07:00 +01:00
Bjørn Erik Pedersen 0eb76b0863 Revert "hugolib: Add terms' pages to .Data.Pages"
This reverts commit e117b1b2c7.

Will have to think a little about this.
2017-02-25 18:14:48 +01:00
Bjørn Erik Pedersen a8a8249f67 Revert "hugolib: Render paginator pages for taxonomy terms"
This reverts commit 4d679627ec.

Will have to think a little more about this.
2017-02-25 18:10:51 +01:00
Bjørn Erik Pedersen c1425a166d hugolib: Fix preserveTaxonomyNames regression
Fixes #3070
2017-02-23 10:09:42 +01:00
Bjørn Erik Pedersen 4d679627ec hugolib: Render paginator pages for taxonomy terms
See #2826
2017-02-22 21:31:52 +01:00
Bjørn Erik Pedersen e117b1b2c7 hugolib: Add terms' pages to .Data.Pages
Fixes #2826
2017-02-22 21:13:21 +01:00
Bjørn Erik Pedersen 9e6b5eb98e hugolib: Temporarily disable leaktest
See #3082
2017-02-22 09:38:55 +01:00
Bjørn Erik Pedersen 0f109faefb hugolib: Fix broken shortcode tests 2017-02-22 00:14:27 +01:00
Bjørn Erik Pedersen 6278393540 hugolib: Include full filepath on shortcode errors
Fixes #3079
2017-02-21 22:54:19 +01:00
Bjørn Erik Pedersen 13972d6c83 hugolib: Cleanup the Goroutine count calculation 2017-02-21 18:56:56 +01:00
bogem 9e52477d94 hugolib: Add relativeURLs and canonifyURLs to Site 2017-02-21 15:08:45 +01:00
John Feminella df1ff57d1a Use Page.Params more consistently when adding metadata 2017-02-21 14:23:39 +01:00
Bjørn Erik Pedersen 2cbdd65330 tpl, hugolib: Fix live-reload of non-renderable content pages
Fixes #3062
2017-02-21 13:56:20 +01:00
Bjørn Erik Pedersen 75d855c086 hugolib: Add check for p.Markup == "org"
To be improved.
2017-02-21 08:49:04 +01:00
Chase Adams 86e8dd62f0 all: Add org-mode support
Fixes #1483 
See #936
2017-02-21 08:46:03 +01:00
Bjørn Erik Pedersen a3af4fe46e hugolib: Finish menu vs section content pages
This commit also fixes the default menu sort when the weight is 0.

Closes #2974
2017-02-20 22:20:02 +01:00
Abdo Roig-Maranges 2a6b26a7a5 hugolib: Improve menu generation for section pages with content
When using the lazy blogger setting to automatically generate menu
entries from section pages, we now recognize section pages that have
content, and use the weight and linktitle configured in the frontmatter.

This way, we can use the lazy blogger automatic generation, and
influence menu order and translations, directly from the frontmatter.

Updates #2974
2017-02-20 22:20:02 +01:00
Bjørn Erik Pedersen fe9fd0acf4 hugolib: Cache the value of Page's RelPermalink 2017-02-20 09:05:35 +01:00
bogem 7e0fa13faa Get rid of some viper.Get* calls
Enforce usage of PathSpec

Fixes #3060
Updates #2728
2017-02-20 08:10:13 +01:00
Abdó Roig-Maranges 02b120d1bd hugolib: Discard current language based on .Lang()
Otherwise we fail to skip the current language in translations
for paginated pages.

Fixes #2972
2017-02-19 15:00:18 +01:00
Bjørn Erik Pedersen 6809ea1e7c hugolib: Fix .Site.LastChange
This commit makes sure that the `.Site.LastChange` is fetched from the latest page modification date.

Previously, this value was fetched from the last page in the default page sort, which may not be the last by date
if weight is set.

Fixes #2909
Closes #2910
2017-02-19 13:48:21 +01:00
Bjørn Erik Pedersen a0b3d9db16 hugolib: Add temporary date parse test
To debug the irregular Windows test failure.

See #3059
2017-02-19 13:19:15 +01:00
Bjørn Erik Pedersen 2ea242d5fe hugolib: Minor Go vet fix 2017-02-19 10:33:28 +01:00
Anton Staaf 99fbc75e7a hugolib: Fix regression of .Truncated evaluation in manual summaries
This fixes the behavior of .Truncated that was introduced with commit
bef496b97e which was later broken.  The
desired behavior is that .Truncated would evaluate to false when there
was nothing after the user defined summary marker.

This also adds a simple unit test to ensure that this feature isn't
broken again.  The check for content after the user defined summary
marker is done on the raw content instead of the working copy because
some of the markup renderers add elements after the marker, making it
difficult to determine if there is actually any content.

The behavior (evaluating to false when there is no content, just
summary) is also now documented.
2017-02-19 10:11:49 +01:00
Bjørn Erik Pedersen 9416fdd334 hugolib: Add missing page kind to allKinds 2017-02-19 09:15:30 +01:00
John Feminella b2e3748a4e hugolib: Enhance .Param to permit arbitrarily nested parameter references
The Param method currently assumes that its argument is a single,
distinct, top-level key to look up in the Params map. This enhances the
Param method; it will now also attempt to see if the key can be
interpreted as a nested chain of keys to look up in Params.

Fixes #2598
2017-02-19 08:50:08 +01:00
Bjørn Erik Pedersen 6d2281c8ea hugolib: Add disableKinds option
Fixes #2534
2017-02-18 22:53:23 +01:00
Bjørn Erik Pedersen 4493e8ed9f hugolib: Fix issue with taxonomies when only some have content page
Fixes #2992
2017-02-18 08:37:11 +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
Cameron Moore 10c13f5d79 hugolib: Make RSS item limit configurable
Add a new rssLimit site configuration option with default of 15.  Prior
to this fix, you could create your own RSS feed to override the default
limit of 15, but we still had a hardcoded limit of 50 items set in
`hugolib.renderRSS()`.

With this option in place, the `range first 15 .Data.Pages` logic is no
longer hardcoded into the embedded RSS template.

Because the size of the slice passed to the template is now limited to
rssLimit instead of 50, this commit is a breaking change for sites
with a custom RSS template that expects more than 15 items.

Fixes #3035
2017-02-17 19:53:08 +01:00
Bjørn Erik Pedersen ade207635e hugolib: Fix Windows build failure, final take 2017-02-17 18:34:58 +01:00
Bjørn Erik Pedersen 0946630715 hugolib: Fix Windows build failure, take 2 2017-02-17 18:28:14 +01:00
Bjørn Erik Pedersen 9421690281 hugolib: Fix Windows build failure 2017-02-17 18:22:36 +01:00
Bjørn Erik Pedersen 53d07fb409 hugolib: Add test case for empty Pages in regular pages
Fixes #2947
2017-02-17 17:26:09 +01:00
Bjørn Erik Pedersen 04a4a193a9 hugolib: Remove deprecated marked for removal
Fixes #3029
2017-02-17 17:20:46 +01:00
Bjørn Erik Pedersen 77cbe4d60b tplimpl: Refactor imageConfig into a struct
Updates #2701
2017-02-17 17:15:26 +01:00
Bjørn Erik Pedersen c507e2717d tpl: Refactor package
Now:

* The template API lives in /tpl
* The rest lives in /tpl/tplimpl

This is bound te be more improved in the future.

Updates #2701
2017-02-17 17:15:26 +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 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