Commit graph

1167 commits

Author SHA1 Message Date
Cameron Moore
b277cb33e4 hugolib: Move metrics output to the end of the site build 2017-09-27 21:26:08 +02:00
Cameron Moore
b4a14c25fe metrics: Add simple template metrics feature 2017-09-26 20:03:04 +02:00
Bjørn Erik Pedersen
fb33d8286d Use Chroma as new default syntax highlighter
If you want to use Pygments, set `pygmentsUseClassic=true` in your site config.

Fixes #3888
2017-09-25 08:59:02 +02:00
Bjørn Erik Pedersen
b180477631 Add liveReloadPort flag to server
This makes live reloading behind a HTTPS proxy working, as in the example below using the service from https://ngrok.com:

```
hugo server -b https://ba6sdfe72.ngrok.io --appendPort=false --liveReloadPort=443 --navigateToChanged
```

Fixes #3882
2017-09-23 17:08:48 +02:00
Bjørn Erik Pedersen
2d613dd905 tpl/tplimpl: Fix escaped HTML Go 1.9 multioutput issue (#3880)
Fixes #3876
2017-09-13 12:32:06 +02:00
Bjørn Erik Pedersen
202510fdc9 hugolib: Fix "published" front matter handling
Also related:

* support "modified" as an optional way to signal "last modified"
* make sure all relevant page dates are also added to params

Fixes #3867
2017-09-08 12:28:15 +02:00
Fiisio
573deca089 hugolib: Fix typo in aquired
Signed-off-by: wgliang <liangcszzu@163.com>
2017-09-07 16:21:33 +02:00
Bjørn Erik Pedersen
3b4f17bbc9 hugolib: Implement "related content"
This closes #98, even if this commit does not do full content text search.

We may revisit that problem in the future, but that deserves its own issue.

Fixes #98
2017-09-06 00:20:02 +02:00
Bjørn Erik Pedersen
08f48b91d6 compare, hugolib, tpl: Add Eqer interface
And use it in `eq` and `ne` so `Page` values can be compared directly in the templates without thinking about it being a `Page` or a `PageOutput` wrapper.

Fixes #3807
2017-08-18 07:36:32 +02:00
Bjørn Erik Pedersen
2a2e690707 hugolib: Simplify Page.Eq 2017-08-17 09:43:39 +02:00
Bjørn Erik Pedersen
a7555c5431 hugolib: Do not return error in Eq on type mismatch 2017-08-17 08:32:47 +02:00
Bjørn Erik Pedersen
c265c102ae hugolib: Rename Page.Equals to Page.Eq
To get the name in line with the template func `eq`.
2017-08-16 10:01:16 +02:00
Bjørn Erik Pedersen
f0f49ed9b0 hugolib: Add Page.Equals 2017-08-16 09:59:42 +02:00
Bjørn Erik Pedersen
71ae9b4533 hugolib: Rewrite replaceDivider to reduce memory allocation
```bash
name              old time/op    new time/op    delta
ReplaceDivider-4   9.76µs ±105%    7.96µs ±24%     ~     (p=0.690 n=5+5)

name              old alloc/op   new alloc/op   delta
ReplaceDivider-4    3.46kB ± 0%    1.54kB ± 0%  -55.56%  (p=0.008 n=5+5)

name              old allocs/op  new allocs/op  delta
ReplaceDivider-4      6.00 ± 0%      1.00 ± 0%  -83.33%  (p=0.008 n=5+5)
```
2017-08-14 09:42:55 +02:00
Bjørn Erik Pedersen
199816fddd hugolib: Extract replaceDivider logic
To its own function and add a test and a benchmark for it.
2017-08-14 09:42:55 +02:00
Nic Raboy
919bc9210a Add an iFrame title to the YouTube shortcode
To accommodate modern web accessibility as outlined here https://dequeuniversity.com/tips/provide-iframe-titles
2017-08-12 00:36:40 +02:00
Johan Gielstra
0f9f73cce5 Add support for multiple config files via --config a.toml,b.toml,c.toml 2017-08-09 20:13:02 +02:00
Bjørn Erik Pedersen
e2f8664ef4 hugolib: More spelling 2017-08-08 10:54:35 +02:00
Bjørn Erik Pedersen
46ac745374 all: Fix spelling
And some other minor issues.
2017-08-07 20:19:24 +02:00
Bjørn Erik Pedersen
4b54fb0701 all: gofmt -s 2017-08-07 20:03:15 +02:00
Jorin Vogel
81c13171a9 Add some missing doc comments
As pointed out by the linter, some exported functions and types are
missing doc comments.
The linter warnings have been reduced from 194 to 116.
Not all missing comments have been added in this commit though.
2017-08-03 15:57:51 +02:00
Bjørn Erik Pedersen
9891c0fb0e Remove sourceRelativeLinks
Fixes #3766
2017-08-02 22:04:38 +02:00
Jorin Vogel
09907d36af Switch from fork bep/inflect to markbates/inflect
Original package has received updates the fork hasn't.
Without fork updates are easier to maintain.
2017-08-01 13:05:09 +02:00
Bjørn Erik Pedersen
8fb594bfb0 Make the title case style guide configurable
This works for the `title` func and the other places where Hugo makes title case.

* AP style (new default)
* Chicago style
* Go style (what we have today)

Fixes #989
2017-07-31 22:16:46 +02:00
Max Rydahl Andersen
aee2b06780 Add --debug option to be improved on over time
Why:

 * first time using hugo I got very little info from --verbose output
   but I noticed there is quite a lot of useful DEBUG logging
 * asked for in other issues like https://github.com/gohugoio/hugo/issues/3514

This change addreses the need by:

 * adding a simple --debug flag which simply turns on debug level in stdout
   and logoutput if enabled.
2017-07-27 22:36:22 +02:00
Bjørn Erik Pedersen
dbe63970e0 hugolib: Support reflinks starting with a slash
Fixes #3703
2017-07-21 13:08:32 +02:00
Vasyl Solovei
b60aa1a504 helpers: Add --trace to asciidoctor args
This will help to understand and fix errors by
seeing stacktrace of an error.

See #3714
2017-07-21 03:07:56 -06:00
Bjørn Erik Pedersen
deccc54004 hubolib: Add HasShortcode
Fixes #3707
2017-07-17 23:20:13 +02:00
Bjørn Erik Pedersen
61bb3ccab3 hugolib: Improve panic handling in layout rendering 2017-07-14 10:26:51 +02:00
Bjørn Erik Pedersen
794ea21e94 hugolib: Make template panics into nice error messages 2017-07-14 10:08:04 +02:00
Bjørn Erik Pedersen
aa6b1b9be7 output: Support templates per site/language
This applies to both regular templates and shortcodes. So, if the site language is French and the output format is AMP, this is the (start) of the lookup order for the home page:

1. index.fr.amp.html
2. index.amp.html
3. index.fr.html
4. index.html
5. ...

Fixes #3360
2017-07-04 09:12:44 +02:00
Bjørn Erik Pedersen
a1d260b41a hugolib: Extend the sections API
This commit adds some section related methods that have been asked for:

* .CurrentSection
* .IsDescendant
* .IsAncestor

Fixes #3591
2017-07-04 09:11:49 +02:00
Bjørn Erik Pedersen
dd9b1baab0 hugolib: Make .Site.Sections return the top level sections
See #3591
2017-07-04 09:11:49 +02:00
Mitchell Cohen
41805dca9e hugolib: Render 404.html for all languages
Fixes #3598
2017-07-01 22:58:52 +02:00
Bjørn Erik Pedersen
72fd871710 hugolib: Add more summary test
Closes #2973
2017-06-28 20:30:26 +02:00
Bjørn Erik Pedersen
c825a73121 Support open "current content page" in browser
This commit adds a new `--navigateToChanged` and config setting with the same name, that, when running the Hugo server with live reload enabled, will navigate to the current content file's URL on save. 

This is really useful for site-wide content changes (copyedits etc.).
Fixes #3643
2017-06-26 21:34:16 +02:00
Bjørn Erik Pedersen
0f40e1fadf media, hugolib: Support extension-less media types
This change is motivated by Netlify's `_redirects` files, which is currently not possible to generate with Hugo.

This commit adds a `Delimiter` field to media type, which defaults to ".", but can be blanked out.

Fixes #3614
2017-06-20 11:04:14 +02:00
Bjørn Erik Pedersen
516e6c6dc5 hugolib: Add disableAliases
Note that even with this setting enabled, the aliases themselves are preserved on the pages.

The big motivation for this change is to be able to use the alias definitions to generate `.htaccess` or Netlify's `_redirect` files with server-side redirects.

Fixes #3613
2017-06-20 11:03:34 +02:00
Bjørn Erik Pedersen
3183b9a29d parser: Fix handling of quoted brackets in JSON front matter
Also remove a broken JSON test.

Fixes #3511
2017-06-19 16:45:52 +02:00
Bjørn Erik Pedersen
fb53987a4f hugolib: Fix error handling for JSON front matter
Fixes #3610
2017-06-19 14:41:03 +02:00
Bjørn Erik Pedersen
5103935ae8 hugolib: Disable shaky leaktest on CI 2017-06-13 21:22:47 +02:00
Bjørn Erik Pedersen
873a6f1885 Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
Bjørn Erik Pedersen
c17ad675e8 all: Update textual references in Go source to point to gohugoio/hugo 2017-06-13 18:47:17 +02:00
Bjørn Erik Pedersen
d8717cd4c7 all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
Bjørn Erik Pedersen
a30023f5cb hugolib: Fix section logic for root folders with subfolders
This commit fixes an issue introduced in the recently released Hugo 0.22.

This logic did not handle the case with root sections with non-section subfolders very well.

Fixes #3586
2017-06-13 12:41:50 +02:00
Bjørn Erik Pedersen
1f26420d39 hugolib: Support sub-sections in permalink settings
This enables both the variants below:

Current (first level only):

```
"blog": ":section/:title",
```

Nested (all levels):

```
"blog": ":sections/:title",
```

Should ideally been part of Hugo 0.22, but better late than never ...

Fixes #3580
2017-06-13 11:42:32 +02:00
Bjørn Erik Pedersen
f1da5a15a3 hugolib: Make the RSS feed use the date for the node it represents
Closes #2708
2017-06-09 01:10:16 +02:00
Alexandros
d5ab7f087d Add noindex tag to HTML generated by Hugo Aliases
So that Googlebot can stop keeping the old URLs in the SERPs.
2017-06-08 23:12:39 +02:00
Bjørn Erik Pedersen
55dd533bf7 hugolib: Unexport some internal methods 2017-06-08 22:33:18 +02:00
Bjørn Erik Pedersen
fe901b8119 hugolib, commands: Improve live-reload on directory structure changes
This issue is more visible now that we support nested sections.

This commit makes operations like pasting new content folders or deleting content folders during server watch just work.

Fixes #3570
2017-06-08 20:14:28 +02:00