1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

86 Commits

Author SHA1 Message Date
24c1770288 hugolib: Revise paginator alias path handling 2017-03-27 15:43:56 +02:00
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
c71e1b106e all: Refactor to nonglobal file systems
Updates #2701
Fixes #2951
2017-02-04 11:37:25 +07:00
bc06135c96 helpers: Allow tilde in URLs
See #2177
2017-01-07 19:29:20 +01:00
8b0c3b9b27 helpers: Remove "no theme set" warning
Fixes #2821
2016-12-23 19:48:50 +01:00
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
65e5959bad helpers: Simplify 2016-11-23 18:54:57 +01:00
e81c06c3f0 helpers: Rename WalkRootTooShortError to ErrWalkRootTooShort
Fix golint warning: helpers/path.go:473:5: error var
WalkRootTooShortError should have name of the form ErrFoo

See #2014
2016-11-23 09:13:00 +01:00
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
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
b86a605bfb Make paginate settings configurable per language
Fixes #2449
2016-09-15 09:32:52 +02:00
c700cdc39c Replace some leftover os.Stat with hugofs.Source 2016-09-11 20:00:38 +02:00
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
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
b426c20e14 Return specific error on walk path too short 2016-07-30 22:32:03 +02:00
15b6693541 Adjust the sanity check to path length 4 2016-07-30 20:07:35 +02:00
94d998989d Add sanity check to the file walker
As more tests now hit the virtual filesystem, add this check
to prevent any walking of the entire file system.
2016-07-30 19:54:07 +02:00
5f5fccbc36 Do not return empty theme dirs
This prevents reading data etc. from the root.

Fixes #2320
2016-07-30 16:21:57 +02:00
9489272681 Handle errors during filesystem walk
Fixes #2318
2016-07-30 14:03:38 +02:00
330639d2ae Fix panic when using URLize
Using URLize on a string like '100%-true' would cause a panic
2016-07-11 10:06:40 +02:00
dbfc7ea024 Fix error handling in SymbolicWalk 2016-03-25 18:18:39 +01:00
bfe8009415 helpers: Fix SymbolicWalk for the root folder
handle the root folders themselves.

This commit fixes that.

Fixes #2018
2016-03-25 12:49:23 +01:00
8a60571fd2 helpers: Fix and add Godoc in path* 2016-03-23 10:03:29 +01:00
6ff2e1dbe7 helpers: Remove the else in MakePathSanitized 2016-03-23 09:45:18 +01:00
e5aa477491 Add support for symbolic links for content, layout, static, theme
Note: This is for the content roots only, but that should satisfy most needs.

Fixes #1855
2016-03-21 19:13:29 -04:00
c42982f76b Add '+' as one of the valid characters in urls specified in the front matter
Fixes #1290
2016-03-21 18:48:50 -04:00
0a768ec95f Simplify GetDottedRelativePath 2016-03-19 17:17:17 +01:00
91ffc76b24 helpers: Remove unused code 2016-03-14 15:20:36 +01:00
a2abad9677 Add support for Go 1.6 block keyword in templates
NOTE: Needs Go 1.6 to use the new feature.

Fixes #1832
2016-03-10 10:53:54 +01:00
47587321d9 Add themesDir option to configuration
themesDir can be used to change the default
path of the themes folder.

Fixes 1556
2016-01-01 14:46:40 -05:00
40fccf2251 Fixes #1292 2016-01-01 14:35:58 -05:00
de82404d35 Fix hugo server "Watching for changes" path display
especially when the given `--source` path is a relative directory.

Also, when `--source` is specified, make WorkingDir an absolute path
from the very beginning, to be consistent with the case when `--source`
is not given.  Otherwise, the function name helpers.AbsPathify(), which
prepends WorkingDir to a relative path, does not really make sense.

Fixes #1721
2015-12-19 05:19:31 -07:00
6042fc2b83 move some of the path helper utilities to afero
and provide wrappers in Hugo.
2015-12-08 16:46:43 -05:00
e445c35d6a Fix copyright headers in source files
Still need to add some missing headers and an AUTHORS file.

See #1646
2015-12-07 19:57:01 +01:00
f045d7a611 Change the license to Apache 2.0 2015-11-23 22:16:36 -05:00
b00771ca14 Simplify ExtractRootPaths 2015-11-23 22:35:54 +01:00
831e936846 Improve "watching for ..." logging 2015-11-23 16:32:06 +01:00
36adb5fb88 Preserve Unicode marks in MakePath
Fixes #1488
2015-10-18 10:36:27 +02:00
6a3aced15a Rename prettiyPath to prettifyPath 2015-10-15 10:15:26 +02:00
5619fe52d3 Unexport internal path helper 2015-10-14 21:34:34 +02:00
52d94fa675 Add config option "disablePathToLower"
Enabling this prevents lowercasing of the path/url.

Fixes #557
2015-09-01 15:26:02 +02:00
5b90b388cb Unexport FileAndExt
If needed outside helpers, create an exported file path (FilePathAndExt?)  and/or a url version.
2015-08-26 21:29:32 +02:00
b05a292c21 Revert "Fix some Go code doc issues"
This reverts commit de7dd70bbc1ac533f137e5f788e1b337d6ba6b8c.

Broke the code fence feat.
2015-08-07 20:09:40 +02:00
de7dd70bbc Fix some Go code doc issues 2015-08-06 22:58:10 +02:00
1058cb17d1 Refactor theme path helper functions.
Reduce duplication (`x + FilePathSeparator + y` a few lines away from `filepath.Join(x, y)`) and add a `GetThemeDir()` function to get the current theme's directory.

Also add a comment complaining about the `GetThemesDirPath()` function, which doesn't seem to do what its name would suggest. This might be a candidate for deprecation?
2015-06-25 18:05:43 +02:00
50269f2512 Remove superfluous return 2015-06-16 22:31:51 +02:00
4b7c1342fd Make removal of accents in taxonomy and section paths optional
And default off.

Fixes #1180
2015-06-16 19:25:48 +02:00
bep
3ea4df35f2 Remove accents in URLs
So the taxonomy `Gérard Depardieu` gives paths on the form `gerard-depardieu`.

Unfortunately this introduces two imports from the `golang.org/`, but Unicode-normalization isn't something we'd want to write from scratch.

See https://blog.golang.org/normalization

See #1180
2015-05-31 20:30:45 +02:00
bep
be7404e337 Support Fish and Chips section
Section names are also used as the title of the list pages, but naming section folders as `Fish and Chips` and similar didn't work very well.

This commit fixes that.

This commit also changes the title casing of the section titles. Some may argue that this is a breaking change, but the old behaviour was also pretty broken,
even for languages that use title capitalizations, as it didn't follow any particular style guide, `fish and chips` became `Fish And Chips` etc.

Now it just turns the first letter into upper case, so `Fish and Chips` will be left as `Fish and Chips`.

People wanting the good old behaviour can use the `title` template func.

Fixes #1176
2015-05-28 23:05:17 +02:00
bep
be964e95a1 Never remove trailing slash in RelPermalink
Fixed #1174
2015-05-27 20:41:43 +02:00