Commit graph

2960 commits

Author SHA1 Message Date
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
1eb3c4a8e7 docs: Fix list template link 2016-11-22 00:37:10 +01:00
Bjørn Erik Pedersen
3031793431 docs: Add a simple list template
Fixes #2710
2016-11-20 15:37:18 +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
65f803e1fa docs: Rename RSSlink to RSSLink
The former will be deprecated.
2016-11-19 12:00:25 +01:00
Albert Nigmatzianov
29fda0e683 commands: Make benchmark command more useful
* Add information about average time, memory consumption and
allocations.
* Fix situation, when user provides memprofile and cpuprofile, but
cpuprofile will not created.

Fixes #2432
2016-11-19 00:06:54 +01:00
balaramadurai
7b8a09d5f9 docs: Add balaramadurai.net to the showcase 2016-11-18 17:41:18 +01:00
Bjørn Erik Pedersen
ce5f41ffb6 vendor: Update deps 2016-11-16 13:28:21 +01:00
Tristan Rice
a49f838cd0 tpl: Add imageConfig function
Add imageConfig function which calls image.DecodeConfig and returns the height, width and color mode of the image. (#2677)

This allows for more advanced image shortcodes and templates such as those required by AMP.

layouts/shortcodes/amp-img.html
```
{{ $src := .Get "src" }}
{{ $config := imageConfig (printf "/static/%s" $src) }}

<amp-img src="{{$src}}"
           height="{{$config.Height}}"
           width="{{$config.Width}}"
           layout="responsive">
</amp-img>
```
2016-11-16 13:00:45 +01:00
Albert Nigmatzianov
950034db5c source, tpl: Fix staticcheck complaints
tpl/template_funcs.go:1019:3: the surrounding loop is unconditionally terminated
source/lazy_file_reader.go:66:5: err != nil is always true for all possible
values ([nil:error] != [nil:error])
2016-11-15 21:22:43 +01:00
Rafael Monteiro
bb36d57be5 docs: Fix typos in extras/scratch.md 2016-11-13 13:45:31 +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
4b4ab47553 hugolib: Fix page sorting when weight is zero
Fixes #2673
2016-11-06 15:39:33 +01:00
Ahmed Zetao Yang
52e2fd27f8 docs: Add article by Zetao Yang 2016-11-06 14:33:24 +01:00
JoeArizona
b619eb5ad1 docs: Compress Hugo logo (hugo.png) 2016-11-06 14:26:44 +01:00
Bjørn Erik Pedersen
07eb3a50c7 tpl: Golint fixes 2016-11-05 17:28:14 +01:00
Bjørn Erik Pedersen
d4830fc4fd helpers: Golint fixes 2016-11-05 17:28:14 +01:00
Bjørn Erik Pedersen
72156e403c hugolib: Simplify range 2016-11-05 17:28:13 +01:00
digitalcraftsman
8dace9ad6d docs: Update roadmap
Closes #2666
2016-11-04 20:18:13 +01:00
digitalcraftsman
f4afd13386 Enhance commit message guidelines 2016-11-04 19:37:41 +01:00
digitalcraftsman
ec44ad5c0b docs: Link latest change as commit in the footer 2016-11-04 19:12:17 +01:00
Adrien Poupin
774f13bd5d doc: Add a "Deployment with rsync" tutorial page
This is kind of a generic process and not so difficult. It seems important to me that it should be documented.
2016-11-04 17:00:24 +01:00
Bjørn Erik Pedersen
0cd0adda20 transform: Return any read or write error from Apply 2016-11-04 00:44:49 +01:00
Albert Nigmatzianov
3a86aba517 commands: Move initialization of flags in separate function
And clean up flag variables.
2016-11-03 11:33:53 +01:00
Bjørn Erik Pedersen
c9be931ebe docs: Remove non-showcase Hugo sites
I.e. sites with no mention of Hugo or hugo etc. in the HTML source.

Fixes #2655
2016-11-02 19:12:58 +01:00
Bjørn Erik Pedersen
e8380e612f Add GitInfo
This commit adds a `GitInfo` object to `Page` if `EnableGitInfo` is set.

It then also sets `Lastmod` for the given `Page` to the author date provided by Git.

The Git integrations should be fairly performant, but it adds "some time" to the build, somewhat depending on the Git history size.

If you want, you can run without during development and turn it on when deploying to the live server: `hugo --enableGitInfo`.

Fixes #2102
2016-11-01 23:04:12 +01:00
Prashant Karmakar
186db7cd7a Fix page names that contain dot
changes:
    - in hugolib/page.go, `func permalink` and `func TargetPath`
      Fixed the attempt to *replace* the extension of something
      that was *already* a basename.
    - in source/file.go, `func NewFile`
      added check for allowed languages before translating filename

Fixes #2555
2016-11-01 14:18:24 +01:00
Bjørn Erik Pedersen
cda3b36fe2 Revert "docs: Add www.bullion-investor.com to the showcase gallery"
No hugo generator tag, probably not a Hugo a site, certainly not a showcase.

This reverts commit b5bc74ca46.
2016-10-31 22:32:53 +01:00
ITSecMedia
b5bc74ca46 docs: Add www.bullion-investor.com to the showcase gallery 2016-10-29 14:21:25 +02:00
digitalcraftsman
01cfcce6c0 docs: Add two articles written by Hash Borgir 2016-10-29 14:02:14 +02: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
Bjørn Erik Pedersen
342b6fe8a5 Make it clear that Path is relative to content root
Fixes #2290
2016-10-28 10:35:19 +02:00
Bjørn Erik Pedersen
4ad39445ef Refactor Page tests
* To handle config in one place
* To use the real builder chain
2016-10-28 10:02:46 +02:00
Bjørn Erik Pedersen
f5b2645566 Remove Wercker config
Hopefully fixes
2016-10-27 21:43:43 +02:00
Bjørn Erik Pedersen
301e4c7e78 Make Amber read from the Afero source file system 2016-10-26 20:50:12 +02:00
Bjørn Erik Pedersen
0406be3d54 Add missing template error logging 2016-10-25 22:56:44 +02:00
Joonatan Saarhelo
89e3125664 Get rid of the rawContentCopy field of the Page struct
It is not needed, because it is only used to store temporary data during `preparePagesForRender`.
2016-10-25 20:40:32 +02:00
Sam Klein
c936b6c89a docs: Fix punctuation in content.md
- removed comma on line 16 to avoid confusion between clauses
- added period to line 24 for consistency
- clarified "read on" on line 30 to follow style above it while
  also verbally writing what the author seems to intend
- removed "You probably know what to do." on line 30 due to wordiness
  that could lead to confusion and a drag in reading speed
2016-10-24 23:56:39 +02:00
teodorraul
c859810b37 docs: Add clearhaus.com to the showcase 2016-10-24 23:52:21 +02:00
Sam Klein
a2cc2e75a6 docs: Fix typos in content section
- changed preposition into intended infinitive for syntactical clarity
- removed "easily" as it doesn't describe anything technical and is
  confusing (which is why the author may have used a preposition)
2016-10-24 23:43:28 +02:00
Bjørn Erik Pedersen
333bb05512 Remove now superfluous lowercasing
See #2615
See #1129
2016-10-24 21:33:11 +02:00
Bjørn Erik Pedersen
5859c691ec vendor: Update Viper 2016-10-24 21:21:37 +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
Luca Corbatto
d9f54a13c1 Handle ToC before handling shortcodes
Fixes #2433
2016-10-24 14:40:57 +02:00
Bjørn Erik Pedersen
165edc7f0a tpl: Fix comment 2016-10-24 14:32:31 +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
digitalcraftsman
dffd7da07c docs: Clarify installation of themes 2016-10-22 17:08:35 +02:00
Nicholas Thomson
6427fba90b docs: Improve instructions in quickstart.md 2016-10-21 19:20:34 +02:00