Commit graph

337 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 06d12ab895 Add proper Language and Languages types 2016-09-06 18:32:15 +03:00
Alexandre Bourget ec33732fbe Add multilingual support in Hugo
Implements:
* support to render:
  * content/post/whatever.en.md to /en/2015/12/22/whatever/index.html
  * content/post/whatever.fr.md to /fr/2015/12/22/whatever/index.html
* gets enabled when `Multilingual:` is specified in config.
* support having language switchers in templates, that know
  where the translated page is (with .Page.Translations)
  (when you're on /en/about/, you can have a "Francais" link pointing to
   /fr/a-propos/)
  * all translations are in the `.Page.Translations` map, including the current one.
* easily tweak themes to support Multilingual mode
* renders in a single swift, no need for two config files.

Adds a couple of variables useful for multilingual sites

Adds documentation (content/multilingual.md)

Added language prefixing for all URL generation/permalinking see in the
code base.

Implements i18n. Leverages the great github.com/nicksnyder/go-i18n lib.. thanks Nick.
* Adds "i18n" and "T" template functions..
2016-09-06 18:32:15 +03:00
Bjørn Erik Pedersen a0859dc672 Make LazyFileReader use the Afero source fs
Fixes #2317
2016-07-30 15:21:02 +02:00
Bjørn Erik Pedersen ef9b915680 Revert "Throw a noisy error when a post has no layout"
We have to figure out another way. There are perfectly valid reasons not having a layout for a page (I have have some broken sites as result of this).

See #1313

This reverts commit b15934008f.
2016-07-14 11:29:21 +02:00
Aditya Bhargava b15934008f Throw a noisy error when a post has no layout
Fixes #1313
2016-07-13 23:57:18 +02:00
Bjørn Erik Pedersen 8588103316 Unexport ShouldBuild and AssertShouldBuild 2016-06-14 15:53:49 +02:00
Hanchen Wang eeaafb4b26 hugolib: futureStats plural 2016-06-14 15:45:27 +02:00
Hanchen Wang 673e41bf6a hugolib: Add expiredStats to build feedback 2016-06-14 15:45:26 +02:00
Hanchen Wang 32c0e3fd1f hugolib: Bug fix futureStats 2016-06-14 15:45:26 +02:00
Hanchen Wang 6472f158a4 hugelib: Add expiredCount as a Site variable 2016-06-14 15:45:25 +02:00
Bjørn Erik Pedersen a7f51703c4 Add Hugo generator tag to home page if not present
Fixes #2182
2016-06-04 21:55:56 -04:00
Steve Francia f94cd2813d Handle errors during rereading properly
Without this fix, any error during rereading would cause Hugo to hang.
Fixes #2168
Closes #2179
2016-06-02 23:47:30 +02:00
Sven Dowideit 22683a3b66 Make alias redirect output URL's relative
Closes #2093
2016-04-22 08:14:19 +02:00
Anthony Fok 9ddf52021b Update import path of fsnotify
Rename "gopkg.in/fsnotify.v1" to "github.com/fsnotify/fsnotify"
per upstream recommendation.

See https://github.com/fsnotify/fsnotify/issues/108 for rationale.
2016-04-20 22:28:26 +08:00
Bjørn Erik Pedersen c0cf1a7e37 Fix section menus for lazy blogger
IsMenuCurrent was always returning false for the top level entries.

Fixes #2065
2016-04-10 13:49:32 +02:00
digitalcraftsman b7efbdc12f hugolib: Add option to disable rendering of 404 page
Fixes #1889
Closes #2037
2016-04-09 20:25:59 +02:00
nitoyon 72bda5ad26 Move section initialization to Site.assembleSections
Closes #1527
2016-04-09 20:13:35 +02:00
Bjørn Erik Pedersen f2ff77f3ac Make Hugo build without Mercurial
By creating a fork of the Bitbucket inflect repo. It hasn't changed since 2013,
so it must be considered pretty stable.

Fixes #2062
2016-04-08 21:11:44 +02:00
Bjørn Erik Pedersen 1c3c148b38 hugolib: Un-export internal Site-methods
These are obviously internal and for the most part undocumented, creating lots of GoLint warnings.

See #1160
See #2014
2016-04-08 17:55:23 +02:00
Sven Dowideit 1648e327c0 Document and clean SourceRelativeLinksEval code 2016-04-07 20:10:38 +02:00
Bjørn Erik Pedersen 54750b0780 Do not create robots.txt by default
Meny people, including me, have a custom robots.txt in static.

Also remove that option from the command line; it doesn't feel
important enough.

Fixes ##2049
2016-04-05 22:20:39 +02:00
Bjørn Erik Pedersen b678e90db7 Use to most specific interface in WriteDestPage 2016-04-02 00:04:08 +02:00
Bjørn Erik Pedersen 4f66f790b1 Add readFile template func
This also includes a refactor of the hugofs package and its usage.

The motivation for that is:

The Afero filesystems are brilliant. Hugo's way of adding a dozen of global variables for the different filesystems was a mistake. In readFile (and also in some other places in Hugo today) we need a way to restrict the access inside the working dir. We could use ioutil.ReadFile and implement the path checking, checking the base path and the dots ("..") etc. But it is obviously better to use an Afero BasePathFs combined witha ReadOnlyFs. We could create a use-once-filesystem and handle the initialization ourselves, but since this is also useful to others and the initialization depends on some other global state (which would mean to create a new file system on every invocation), we might as well do it properly and encapsulate the predefined set of filesystems. This change also leads the way, if needed, to encapsulate the file systems in a struct, making it possible to have several file system sets in action at once (parallel multilanguage site building? With Moore's law and all...)

Fixes #1551
2016-03-31 21:24:18 +02:00
Bjørn Erik Pedersen 8aec5ee2dd hugolib: Some more unexports 2016-03-25 03:12:31 +01:00
Bjørn Erik Pedersen fa1a9653e5 hugolib: Taxonomy GoDoc cleanup 2016-03-24 16:01:25 +01:00
Bjørn Erik Pedersen faf2e50685 Do some minor code cleaning of Site
* Unexport some methods/fields
* Add some godoc

Still plenty to do here.
2016-03-23 09:43:04 +01:00
Bjørn Erik Pedersen dc7d8a9eac Spring cleaning of the menu code 2016-03-23 00:29:39 +01:00
Bjørn Erik Pedersen de8fc8761a Re-render shortcode on template or data file change
Fixes  #1971
2016-03-21 21:09:25 -04:00
Bjørn Erik Pedersen 3529152efe Return early from appendThemeTemplates 2016-03-17 23:36:11 +01:00
Bjørn Erik Pedersen 70739c972e Remove unnecessary type conversions 2016-03-14 20:35:50 +01:00
Bjørn Erik Pedersen dea185aa9b hugolib: Remove unused code 2016-03-14 15:41:03 +01:00
Ján Koščo be3519fac0 Use default sitemap configuration for homepage
Fixes #1304
2016-03-10 11:02:00 +01:00
Bjørn Erik Pedersen 973393c99e Create template clone for late template execution
Fixing some breaking blogs on Go 1.6

Fixes #1879
2016-03-09 14:37:58 +01:00
Bjørn Erik Pedersen c7acc318b5 Add some missing resets on rebuild
Fixes #1928
Fixes #1929
2016-03-06 16:33:32 +01:00
Bjørn Erik Pedersen 023992abad Unexport the target handlers
These are of no interest outside the package.
2016-03-05 20:56:38 +01:00
Bjørn Erik Pedersen 27f8d8f963 Allow URL with extension in frontmatter
Fixes #1923
2016-03-05 20:50:53 +01:00
Bjørn Erik Pedersen ccd2f4c32b Prevent capitalized taxonomy labels
Fixes #1880
2016-03-03 21:54:23 +01:00
Bjørn Erik Pedersen 6b922750f3 Revert "Create template clone for late template execution"
This reverts commit 93b04e67f6.
2016-02-28 12:15:33 +01:00
Bjørn Erik Pedersen 93b04e67f6 Create template clone for late template execution
Fixing some breaking blogs on Go 1.6

Fixes #1879
2016-02-28 11:51:51 +01:00
Bjørn Erik Pedersen 804603155f Check for the presence of pages before setting dates
See #1903
2016-02-27 23:25:41 +01:00
Bjørn Erik Pedersen 75cf324322 Set Date and Lastmod for main home page
Fixes #1903
2016-02-27 23:21:07 +01:00
Tatsushi Demachi e9853642e5 Listen channel before sending values to it
The 'results' channel is not listend before sending error values in a
loop checking IsRenderable or not. This fixes it.
2016-02-20 14:03:06 +09:00
Bjørn Erik Pedersen 50182cd06b Remove superfluous Errorf 2016-02-16 02:05:59 +01:00
Derek Perkins bac1ba4655 Fix spelling and go vet errors 2016-02-13 19:08:48 +08:00
Tatsushi Demachi 68e2e63d92 Fix Hugo hang up with empty content directory
Site.ReadPagesFromSource returns nil chan error value when a site
content directory is empty but its receiver expects to be passed
something error values via the channel.

This fixes it by returning a channel which will be immediately closed.

Fix #1797
2016-02-03 08:19:02 +09:00
Anthony Fok 57eebbf243 Use FEEDBACK instead of ERROR for empty home page warning
jww.ERROR.Println() seems to have become too verbose,
making the warning message intended for new users
a lot less readable.
2016-01-30 17:39:17 +08:00
Bjørn Erik Pedersen 5def6d9aee Make the watch logger less chatty 2016-01-28 15:33:41 +01:00
Steve Francia 9413cf8499 Handle self rename operations gracefully 2016-01-26 14:33:08 -05:00
Steve Francia 7e196a8294 Handle remove & rename source operations incrementally 2016-01-26 14:30:28 -05:00
Steve Francia e01c340915 A single file can be replaced in site.Files 2016-01-26 14:29:37 -05:00