Commit graph

986 commits

Author SHA1 Message Date
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