Commit graph

764 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 80c7ea60a0 Make noHTTPCache default on
This is a development server, so that makes the most sense.

See #3897
2017-09-23 21:17:51 +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 173b544982 commands: Remove superflous space 2017-09-22 20:05:19 +02:00
Bjørn Erik Pedersen df411ec81a commands: Rename noHttpCache to noHTTPCache 2017-09-22 17:23:15 +02:00
Bjørn Erik Pedersen 0b34af2161 Add noHttpCache to hugo server
Fixes #3897
2017-09-22 17:13:21 +02:00
hugoreleaser 5c3b210368 releaser: Prepare repository for 0.28-DEV
[ci skip]
2017-09-13 13:13:28 +02:00
hugoreleaser 18126434f1 releaser: Bump versions for release of 0.27.1
[ci skip]
2017-09-13 11:03:59 +00:00
hugoreleaser 828eb70fa6 releaser: Bump versions for release of 0.27
[ci skip]
2017-09-11 05:32:02 +00:00
Bjørn Erik Pedersen d2249c5099 Set up Hugo release flow on CircleCI
This rewrites the release logic to use CircleCI 2.0 and its approve workflow in combination with the state of the release notes to determine what to do next.

Fixes #3779
2017-09-10 17:14:02 +02:00
Bjørn Erik Pedersen b36f6e31e0 releaser: Bump versions for release of 0.26
[ci skip]
2017-08-07 09:05:07 +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 91f410ea90 Bump versions to 0.26-DEV 2017-07-10 09:16:02 +02:00
Bjørn Erik Pedersen aded65b71d releaser: Prepare repository for 0.25-DEV
[ci skip]
2017-07-10 09:02:20 +02:00
Bjørn Erik Pedersen 0e09be7b3c releaser: Bump versions for release of 0.25.1
[ci skip]
2017-07-10 08:57:34 +02:00
Vasiliy Solovey 7bcc1ce659 commands: Navigate to changed on CREATE
When working with content from IntelliJ IDE,
like WebStorm, every file save is followed by
two events: "RENAME" and then "CREATE".
2017-07-08 09:37:24 +02:00
Bjørn Erik Pedersen 6e086e3d03 releaser: Bump versions for release of 0.25
[ci skip]
2017-07-07 09:23:54 +02:00
Bjørn Erik Pedersen 75f782f035 Revert "commands: Adjust docs path"
This reverts commit 729be8074b.
2017-07-06 10:34:04 +02:00
Bjørn Erik Pedersen 5f831a6223 releaser: Replace the magic version handling
Take the new version as a string value.
2017-07-05 14:27:43 +02:00
Bjørn Erik Pedersen e7a54e7afc releaser: Add --try flag to ease testing 2017-07-05 14:27:43 +02:00
Victor Kropp 1039356edf commands: Support human-readable YAML boolean values in undraft 2017-07-03 23:26:01 +02:00
coderzh 7ee1f25e9e hugo import jekyll support nested _posts directories
Fixes #1890
Closes #1911
2017-07-01 10:15:22 +02:00
Anthony Fok 30e14cc316 Make --navigateToChanged more robust on Windows
This ensures the new "open 'current content page' in browser" works
on Windows, especially with Emacs and Vim.

Special thanks to @bep for coming up with the idea of the fix.

See #3645
2017-06-27 11:45:54 +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
Anthony Fok aff1ac3235 commands: Use example.com as homepage for new theme
The fictional siteforthistheme.com domain has been
squatted by Afternic of GoDaddy since November 2016...
2017-06-26 12:38:45 -06:00
Bjørn Erik Pedersen fd924d1802 commands: Create default archetype on new site
See #3626
2017-06-22 22:00:42 +02:00
Bjørn Erik Pedersen 8f69fe57a4 releaser: Bump versions for release of 0.24
[ci skip]
2017-06-21 13:52:27 +02:00
Bjørn Erik Pedersen 662e12f348 commands, create: Add .Site to the archetype templates
This commit completes the "The Revival of the Archetypes!"

If `.Site` is used in the arcetype template, the site is built and added to the template context.

Note that this may be potentially time consuming for big sites.

A more complete example would then be for the section `newsletter` and the archetype file `archetypes/newsletter.md`:

```
---
title: "{{ replace .TranslationBaseName "-" " " | title }}"
date: {{ .Date }}
tags:
- x
categories:
- x
draft: true
---

<!--more-->

{{ range first 10 ( where .Site.RegularPages "Type" "cool" ) }}
* {{ .Title }}
{{ end }}
```

And then create a new post with:

```bash
hugo new newsletter/the-latest-cool.stuff.md
```

**Hot Tip:** If you set the `newContentEditor` configuration variable to an editor on your `PATH`, the newly created article will be opened.

The above _newsletter type archetype_ illustrates the possibilities: The full Hugo `.Site` and all of Hugo's template funcs can be used in the archetype file.

Fixes #1629
2017-06-19 10:47:00 +02:00
Bjørn Erik Pedersen 422057f607 create: Use archetype template as-is as a Go template
This commit removes the fragile front matter decoding, and takes the provided archetype file as-is and processes it as a template.

This also means that we no longer will attempt to fill in default values for `title` and `date`.

The upside is that it is now easy to create these values in a dynamic way:

```toml
+++
title = {{ .BaseFileName | title }}
date = {{ .Date }}
draft = true
+++
```

You can currently use all of Hugo's template funcs, but the data context is currently very shallow:

* `.Type` gives the archetype kind provided
* `.Name` gives the target file name without extension.
* `.Path` gives the target file name
* `.Date` gives the current time as RFC3339 formatted string

The above  will probably be extended in #1629.

Fixes #452
Updates #1629
2017-06-18 19:06:28 +02:00
Bjørn Erik Pedersen b502b9d8cc releaser: Bump versions for release of 0.23
[ci skip]
2017-06-16 09:41:39 +02:00
Bjørn Erik Pedersen 729be8074b commands: Adjust docs path 2017-06-14 10:37:58 +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 2aafb24766 Revert "releaser: Bump versions for release of 0.22.1"
This reverts commit dce70fb7c5.
2017-06-13 14:26:56 +02:00
Bjørn Erik Pedersen 4bd5ce7ef3 releaser: Prepare repository for 0.23-DEV 2017-06-13 14:25:19 +02:00
Bjørn Erik Pedersen 0f78dd06a4 releaser: Prepare repository for 0.22.1-DEV
[ci skip]
2017-06-13 14:22:14 +02:00
Bjørn Erik Pedersen dce70fb7c5 releaser: Bump versions for release of 0.22.1
[ci skip]
2017-06-13 14:17:15 +02:00
Bjørn Erik Pedersen ff54b6bddc commands: Adjust rlimit to 64000
See #3582
2017-06-12 20:43:19 +02:00
Bjørn Erik Pedersen 629e1439e8 commands: Make error on setting rlimit a warning only
And reduce it to 10000.

Closes #3582
2017-06-12 20:35:19 +02:00
Bjørn Erik Pedersen 26aa06a3db Revert "commands: Remove the rlimit tweaking on macOS"
This reverts commit bcd32f1086.

See #3582
2017-06-12 20:35:19 +02:00
Bjørn Erik Pedersen 21cf464c1f releaser: Bump versions for release of 0.22
[ci skip]
2017-06-12 09:01:59 +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
Bjørn Erik Pedersen 0907a5c1c2 all: Temporarily revert to BurntSushi for TOML front matter handling
We still have go-toml as a transitive dependency, and it is the way to go eventually, but we care about speed, so let us wait that one out.

Note that the issue this fixes is about taxonomies, but I guess this is a general issue for sites with many pages that uses TOML as front matter.

```
benchmark                              old ns/op     new ns/op     delta
BenchmarkFrontmatterTags/TOML:1-4      23206         8543          -63.19%
BenchmarkFrontmatterTags/TOML:11-4     80117         18495         -76.92%
BenchmarkFrontmatterTags/TOML:21-4     140676        28727         -79.58%

benchmark                              old allocs     new allocs     delta
BenchmarkFrontmatterTags/TOML:1-4      173            60             -65.32%
BenchmarkFrontmatterTags/TOML:11-4     625            138            -77.92%
BenchmarkFrontmatterTags/TOML:21-4     1106           210            -81.01%

benchmark                              old bytes     new bytes     delta
BenchmarkFrontmatterTags/TOML:1-4      9231          2912          -68.45%
BenchmarkFrontmatterTags/TOML:11-4     19808         5184          -73.83%
BenchmarkFrontmatterTags/TOML:21-4     31200         7536          -75.85%
```

See #3541
Updates #3464
2017-06-03 09:22:57 +02:00
Albert Nigmatzianov 421a46947a cmd: Replace flagChanged with pflag.FlagSet.Changed 2017-05-24 10:51:51 +02:00
Bjørn Erik Pedersen bcd32f1086 commands: Remove the rlimit tweaking on macOS
Fixes #3512
2017-05-23 18:52:00 +03:00
Bjørn Erik Pedersen 1a965e5d2f releaser: Bump versions for release of 0.21
[ci skip]
2017-05-22 16:09:42 +03:00
Albert Nigmatzianov 94b5be67fc commands: Skip .git directories
Fix #3468
2017-05-15 14:38:04 +03:00
Bjørn Erik Pedersen 5794a265b4 commands, hugolib: Deprecate disable404, disableRSS, disableSitemap, disableRobotsTXT
Use disableKinds instead.

Fixes #3345
2017-05-10 20:00:08 +02:00
Albert Nigmatzianov 9b2028626e commands: Use paths from PathSpec for walker 2017-05-09 14:07:43 +02:00
Albert Nigmatzianov f0f69d03c5 commands: Make first letter of flags' usage lowercase 2017-04-26 22:23:20 +02:00
Bjørn Erik Pedersen 7f6430d84d Automate the Hugo release process
This commit adds a work flow aroung GoReleaser to get the Hugo release process automated and more uniform:

* It can be run fully automated or in two steps to allow for manual edits of the relase notes.
* It supports both patch and full releases.
* It fetches author, issue, repo info. etc. for the release notes from GitHub.
* The file names produced are mainly the same as before, but we no use tar.gz as archive for all Unix versions.
* There isn't a fully automated CI setup in place yet, but the release tag is marked in the commit message with "[ci deploy]"

Fixes #3358
2017-04-24 11:08:56 +02:00
Stefan Buynov 5f3ad1c319 commands: Import Octopress image tag in Jekyll importer 2017-04-22 22:35:52 +02:00
Bjørn Erik Pedersen dac0d4a69d all: Prepare Hugo 0.20 release version 2017-04-10 09:10:53 +02:00
Bjørn Erik Pedersen 7b2e1b0be9 hubolib: Do not add missing trailing slash to command line baseURL
This makes it consistent with how it behaves when it's set in config.toml.

This commit also unifies BaseURL in Site.Info so we now have one source for this value.

Fixes #3262
2017-04-07 20:18:31 +02:00
Bjørn Erik Pedersen 3c405f5172 all: Document the Output Formats feature
This commit also adds a new command, docshelper, with some utility funcs that adds a JSON datafiles to /docs/data that would be a pain to create and maintain by hand.

Fixes #3242
2017-04-07 10:52:16 +02:00
Bjørn Erik Pedersen c4a1165587 all: Handle all errors
As reported by `errcheck`.
2017-04-06 20:35:26 +02:00
Bjørn Erik Pedersen a883948c4f Register all media types when in server mode
Fixes #3274
2017-04-04 18:05:19 +02:00
Bjørn Erik Pedersen 04d80e6e87 commands, helpers: Add correct verbose log level to the global loggers
We still use those in some cases.
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen ee4a33b14f commands: Fix broken commandeer 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen 15b64d51da all: Propagate baseURL error to the callers 2017-03-27 15:43:56 +02:00
Albert Nigmatzianov 9f0b02b898 commands: Fix case of createpath in new.go 2017-03-24 22:19:03 +01:00
Eamonn 559b4007f7 commands: Keep "." directories on cleanDestinationDir
Fixes #3208
2017-03-21 13:10:31 +01:00
Stefan Buynov 9dfb9c1445 Case insensitive translation of the 'more' tag when importing from Jekyll 2017-03-18 16:16:25 +01:00
Anthony Kong 62efcdfed4 commands: Improve jekyll import date format
Allow both yyyy-mm-dd and yyyy-m-d formats in jekyll markdown
file names.
2017-03-13 12:50:57 +01:00
Bjørn Erik Pedersen 5f443bd45b commands: t.Error => t.Errorf 2017-03-11 19:07:32 +01:00
Cameron Moore f039e3be9e parser: Refactor frontmatter parser and add tests
Lots of cleanups here:

- Refactor InterfaceToConfig and InterfaceToFrontMatter to use io.Writer.
- Simplify InterfaceToFrontMatter by wrapping InterfaceToConfig.
- Export FrontmatterType since we return it in DetectFrontMatter.
- Refactor removeTOMLIdentifier to avoid blindly replacing "+++".
- Update HandleJSONMetaData to return an empty map on nil input.
- Updates vendored goorgeous package and test for org-mode frontmatter.
- Add tests and godoc comments.

Coverage for parser package increased from 45.2% to 85.2%.
2017-03-11 17:52:25 +01:00
Albert Nigmatzianov 48120ccfd2 all: Fix some govet complaints 2017-03-09 14:18:12 +01:00
Bjørn Erik Pedersen 3669015f56 Handle Hugo version strings with patch level
Fixes #3025
2017-03-01 15:49:07 +01:00
Bjørn Erik Pedersen a1741f192c Update versions to 0.19 release 2017-02-27 10:49:35 +01:00
bogem 7934db9169 commands: Cache logFile in createLogger 2017-02-21 15:08:45 +01:00
bogem c7535b9c25 commands: Remove flagChanged from commandeer 2017-02-21 15:08:45 +01:00
Bjørn Erik Pedersen 2320c5682c commands: Make sure build error is logged in watch mode
See #3062
2017-02-21 09:46:56 +01:00
Bjørn Erik Pedersen 41857d036d utils: Use local logger 2017-02-21 09:41:56 +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 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 c71e1b106e all: Refactor to nonglobal file systems
Updates #2701
Fixes #2951
2017-02-04 11:37:25 +07:00
digitalcraftsman 99fd7c684f cmd: Remove empty tags/features strings in theme.toml template 2017-01-20 23:44:40 +07:00
Bjørn Erik Pedersen 92ba7219dc commands: Fix newly broken server flag handling 2017-01-11 18:54:27 +01:00
Bjørn Erik Pedersen 45e3ed517a all: Refactor to non-global logger
Note that this looks like overkill for just the logger, and that is correct,
but this will make sense once we start with the template handling etc.

Updates #2701
2017-01-07 17:06:35 +01:00
Cameron Moore 3286b24fce commands: Show OS and ARCH in version output 2017-01-06 11:54:53 +01:00
Bjørn Erik Pedersen c60c41e051 commans: Remove unneeded build constraint
Fixes #2886
2017-01-05 15:45:25 +01:00
Bjørn Erik Pedersen 1b46d2cfee commands, vendor: Remove log level setting in Jekyll command
And update the JWW lib.
2017-01-05 11:58:11 +01:00
Bjørn Erik Pedersen c344b1901f commands, helpers, vendor: Update to the latest jww logger
Updates #2701
2017-01-03 16:57:43 +01:00
bogem 4352156a27 commands, helpers: Fix docs 2017-01-02 17:01:58 +01:00
bogem 52976da0ec commands: Fix case in default config variable 2017-01-02 17:01:12 +01:00
bogem 6fb4f048e1 commands: Fix case in names of some methods 2017-01-02 17:01:12 +01:00
Cameron Moore 8b0c3b9b27 helpers: Remove "no theme set" warning
Fixes #2821
2016-12-23 19:48:50 +01:00
avi b2687ab1f7 command: Add themesDir command argument to specify themes directory 2016-12-22 09:33:08 +01:00
Bjørn Erik Pedersen 3d6fdb8ed3 Bump to 0.18 release version 2016-12-19 15:35:20 +01:00
Cameron Moore 971d1baf13 commands: Add noChmod option to disable perm sync
Includes updates to docs.

Fixes #2749
2016-11-30 08:35:30 +01:00
Bjørn Erik Pedersen 4c72eb12dc commands: Simplify 2016-11-23 18:55:51 +01:00
Bjørn Erik Pedersen ff2498ee89 Remove ShowPlan
It is out of sync with reality, has some disabled tests, and the cost
of getting it up-to-date is too high to be worth it.
2016-11-23 16:35:49 +01:00
bogem 713f577a27 commands, hugolib: Unify case of config variable names 2016-11-22 23:43:55 +01:00
bogem dec1706ae0 commands, hugolib, parser, tpl: Use errors.New instead of fmt.Errorf 2016-11-22 23:43:55 +01:00
bogem 1f130fd692 commands, hugolib, source, target, tpl: Get rid of some fmt statements 2016-11-22 23:43:55 +01:00
bogem 120f6b0cf2 all: Use jww instead of fmt for printing
This is an attempt to unify method for printing.
2016-11-22 22:06:48 +01:00
Bjørn Erik Pedersen 88972b0d5b node to page: Refactor the build process
To make it easier to follow and understand.

Both building and rebuilding now follow a four step flow:

1. Init
2. Process
3. Assemble
4. Render

And now there are only one Build method, used for both builds and rebuilds.

Updates #2297
2016-11-22 09:57:03 +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
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
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 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
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
Bjørn Erik Pedersen d0d24b4337 commands: Do not print error on missing unknown dirs
See #2602
2016-10-19 20:08:57 +02:00
Bjørn Erik Pedersen f0af80753c commands: Only watch relevant themes dir
The same behavior as for the root project.

Fixes #2602
2016-10-19 20:00:51 +02:00
Bjørn Erik Pedersen 794589fbfd Use example.org for replace-this-with-your-hugo-site.com
Fixes #2575
2016-10-14 09:51:39 +02:00
Dimitri Merejkowsky 56512e816f Allow to set cache dir in config file 2016-10-09 11:00:36 +02:00
Chase Adams 3616fb629b command: Fix hugo new for multiple architectures
Changes `%q` to `%s`. `%q` was safely escaping the `\` in windows so that it was printing `\\`. Uses `filepath.Join` for example filepath so that the output is OS specific and since this required splitting up the multiline string, it's refactored into a separate function..

Fixes #2401
2016-10-09 10:59:07 +02:00
Bjørn Erik Pedersen 1c214fcb7c Add quiet mode
Needed to run benchmarks without the stats getting in the way of the benchmark stats.

Fixes #1218
2016-10-08 18:26:16 +02:00
Anthony Fok fe2d246c73 commands: Bump min_version to 0.17 for "new theme" subcommand 2016-10-07 08:36:28 -06:00
Bjørn Erik Pedersen 2a4ed1c492 Add hugo env command
Useful for bug reports.

Fixes #2523
2016-10-05 10:20:25 +02:00
Anthony Fok 6b4d3263b6 commands: Revise instructions after "hugo new site"
mainly to fit inside 80-column wide terminal windows.

See #1164
2016-09-26 14:23:57 -06:00
Bjørn Erik Pedersen 9c017e512e commands: Add some band-aid to convert
Fixes #2458
2016-09-19 10:52:07 +02:00
Bjørn Erik Pedersen 8d040c966f commands: Improve error messages in convert
See #2440
2016-09-13 19:11:59 +02:00
Bjørn Erik Pedersen 7615ef0c28 commands: Report errors in convert
Fixes #2440
2016-09-13 10:49:51 +02:00
Bjørn Erik Pedersen be09781af1 Fix broken convert command
Fixes #2437
2016-09-13 09:59:18 +02:00
Albert f0ac26c944 commands: Fix typos 2016-09-12 11:32:11 +02:00
Bjørn Erik Pedersen c700cdc39c Replace some leftover os.Stat with hugofs.Source 2016-09-11 20:00:38 +02:00
bogem 60baec8005 commands: Delete useless conversion 2016-09-11 12:23:09 +02:00
bogem 2294b0226d commands: Simplify err condition 2016-09-11 12:23:09 +02:00
bogem 1e18087356 commands: Delete unused newUserErrorF 2016-09-11 12:23:09 +02:00
Jelmer Tiete 5867cb5a92 Fixe target path location check in jekyll import command 2016-09-11 10:48:31 +02:00
Bjørn Erik Pedersen 09ed41be71 Add a global Reset func
So we can do some benchmarking.
2016-09-06 18:32:21 +03:00
Bjørn Erik Pedersen 45c69dd168 Handle error in config loading
See #2309
2016-09-06 18:32:19 +03:00
Bjørn Erik Pedersen f1e1cdab3f Improve i18n string handling
* Fall back to default language on missing translation file
* Add a i18n-warnings build flag
* If that flag is set, print a parseable and greppable string on missing translation strings

See #2303
2016-09-06 18:32:19 +03:00
Bjørn Erik Pedersen 9798a95670 Make the check command work in multilingual mode
Or: some more multilingual TODO-fixes.

See #2309
2016-09-06 18:32:18 +03:00
Bjørn Erik Pedersen e56ecab157 Multilingual TODO-fixes, take 1
See #2309
2016-09-06 18:32:18 +03:00
Bjørn Erik Pedersen d18a8cbe15 Fix livereload in multilingual mode
See #2309
2016-09-06 18:32:18 +03:00
Bjørn Erik Pedersen 596e0e98e4 Make it possible to add a language in server mode
See #2309
2016-09-06 18:32:17 +03:00
Bjørn Erik Pedersen 7cac19b1e3 cmd: Load config from the common config loader in hugolib
See #2309
2016-09-06 18:32:17 +03:00
Bjørn Erik Pedersen 8b657a11ee Get the list commands up to multi-site level
This commit also unexports some Site methods, making it clear what the external build API really is.

See #2312
2016-09-06 18:32:17 +03:00
Bjørn Erik Pedersen 90de511017 Make taxonomies configurable per language
See #2312
2016-09-06 18:32:17 +03:00
Bjørn Erik Pedersen f0b91852ea Rework the multilingual docs
And in the same go adjusted some minor parts of the language API:

Add LanguagePrefix alias to Node and rename the Multilingual config section to Languages.

See #2309
2016-09-06 18:32:17 +03:00
Bjørn Erik Pedersen 708bc78770 Optimize the multilanguage build process
Work In Progress!

This commit makes a rework of the build and rebuild process to better suit a multi-site setup.

This also includes a complete overhaul of the site tests. Previous these were a messy mix that
were testing just small parts of the build chain, some of it testing code-paths not even used in
"real life". Now all tests that depends on a built site follows the same and real production code path.

See #2309
Closes #2211
Closes #477
Closes #1744
2016-09-06 18:32:16 +03:00
Bjørn Erik Pedersen f023dfd763 Move the Build* methods to HugoSites
See #2309
2016-09-06 18:32:16 +03:00
Bjørn Erik Pedersen 5b9c2a40f1 Move HugoSites to hugolib
It will get more involved in the build process in a minute.

See #2309
2016-09-06 18:32:16 +03:00
Bjørn Erik Pedersen 75dd596e6c Introduce HugoSites type
And a Hugo global variable which contains the site under build.

This is really needed to get some level of control of the "multiple languages" in play.

There are still work related to this scattered around, but that will come.

With this commit, the multilingual feature is starting to work.
2016-09-06 18:32:16 +03:00
Bjørn Erik Pedersen c447b7dd6e Rename MainSites to Sites
Having many *main* sites doesn't make much sense.
2016-09-06 18:32:16 +03:00
Bjørn Erik Pedersen c4e7c37055 Add Translations and AllTranslations methods to Page
Will revisit Node later.
2016-09-06 18:32:15 +03:00
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 20c4311df4 Switch to a more up to date TOML library
Fixes #2089
2016-08-20 20:33:06 +01:00
Bjørn Erik Pedersen 97c37732b4 Add a global Reset func
So we can do some benchmarking.
2016-08-16 12:50:26 +02:00
Kishin Yagami 661c9787ea commands: Suppress 'missing static' error
Fixes #2311
2016-08-14 00:35:43 +02:00
Jeremy Brown d7f364c27e Fix for meminterval not using specified interval
Hugo seems to ignore the meminterval I specify and always uses it's default of 100ms.
This seems to be because Hugo tries to take the meminterval from the command line
(an Int) and converts it to a String and passes it to time.ParseDuration. If you pass a
different meminterval (such as `1000` as above) it will fail (time.ParseDuration requires
some units) and use the default instead.

Changed `meminterval` to be a String and added better documentation for valid time units.

Resolves: #2325
2016-08-02 19:48:07 +02:00
Bjørn Erik Pedersen 4ddd5361c1 Use the Afero source fs where relevant
Fixes #2319
2016-07-30 15:37:03 +02:00
Pedro Melo 3e1b579c17 Be less aggressive with CHMOD filesystem events
On 4679fbee41, rebuild was disabled on
CHMOD filesystem events, but the code is overly aggressive.

In some situations, specially with older Mac's (using a Late 2008
Macbook), the events we receive might be aggregated. On my
particular laptop, I get this events:

    INFO: 2016/07/26 18:08:51 hugo.go:737: Received System Events: ["<path>": WRITE|CHMOD]

These events are ignored because the code only checks for Chmod. This
commit fixes this by checking that the event is also not a Write or Create.

Related to #1587.
2016-07-26 22:18:15 +02:00
Alexandre Bourget 32d82a4496 Ignore emacs temp files 2016-07-11 02:01:45 +02:00
Vincent Batoufflet b8af06f26a Make auto-date disabled by default
Fixes #2244
Closes #2260
2016-07-08 14:43:10 +02:00
Bjørn Erik Pedersen b581bbd856 Make config flag global
Fixes #2261
2016-07-07 18:06:48 +02:00
Cameron Moore ca6b26fe65 commands: Allow schema-less baseURL on command line
Fixes #1632
2016-06-29 23:08:55 -06:00
Bjørn Erik Pedersen 1accd3ba88 Fix example for autocomplete
See #2235
2016-06-22 13:59:53 +02:00
Hanchen Wang c52bb4efbe commands: Specify os port generic errors
Closes #2217
2016-06-16 15:28:06 +02:00
Bjørn Erik Pedersen aa690c8e95 commands: Fix charsets in mimetypes
Fixes #2218
2016-06-15 19:34:21 +02:00
Hanchen Wang 5461a5e03d commands: Add listExpiredCmd for expired pages 2016-06-14 15:45:26 +02:00
Hanchen Wang 51f7cd9bde commands: Add buildExpired flag 2016-06-14 15:45:26 +02:00
Bjørn Erik Pedersen 683888ebc8 Change hugo to Hugo in help text 2016-06-09 16:03:25 +02:00
Steve Francia d1cf262b74 Ignore __jb_tmp___ files created by IntelliJ 2016-06-02 23:47:01 +02:00
Steve Francia f8e4a0608c Annotate temp files that Hugo ignores 2016-06-02 23:47:01 +02:00
Bjørn Erik Pedersen b5030782ae Ignore Byword temp files
Fixes #2126
2016-05-06 20:30:03 +02:00
Bjørn Erik Pedersen 2b02a402a0 commands: Sett mime type for CSS in Hugo server
Fixes #2104
2016-04-27 21:40:35 +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 b7fd410245 commands: Support config from ENV
So

```bash
env HUGO_TITLE="Some Title" hugo server
```

Will change the `title`.

Fixes #2090
2016-04-18 18:45:37 +02:00
Robert Basic 24cb0d1f58 tpl: Do not write to cache when ignoring cache
Fixes #2067
Closes #2069
2016-04-14 10:48:26 +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
digitalcraftsman d3e829508b commands: Add helpful instuctions after "hugo new site"
Fixes #1164
2016-04-08 18:03:49 +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
Philipp Oppermann 43b5dfabb5 Disable syntax guessing for PygmentsCodeFences by default
This disables highlighting for fenced code blocks without explicitly specified language. It also introduces a new `PygmentsCodeFencesGuessSyntax` config option (defaulting to false).

To enable syntax guessing again, add the following to your config file: `PygmentsCodeFencesGuessSyntax = true`

This is a breaking change.
2016-04-04 22:19:36 +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
digitalcraftsman 7c81c86bdd commands: Apply Golint rules 2016-03-24 23:34:12 +01:00
Bjørn Erik Pedersen a7953e25bb commands: Apply Golint rules to hugo.go 2016-03-24 14:24:22 +01:00
Bjørn Erik Pedersen 1cb7ed6ac7 parser: Spring code cleaning 2016-03-23 14:51:16 +01:00
Bjørn Erik Pedersen 9cf93e11f8 commands: Fix remaining Golint warning 2016-03-23 00:06:10 +01:00
Bjørn Erik Pedersen 283b866386 commands: Do not use named return vals in Jekyll import 2016-03-22 23:44:02 +01:00
srinivasreddy c54df37f6a source: Remove unnecessary else condition 2016-03-22 19:47:47 +01:00
Bjørn Erik Pedersen 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
Cameron Moore 9323707b32 create: Refactor NewContent to be testable
NewContent is refactored to use the afero.Fs interface that should allow
full testing.  This commit also pulls the metadata creation logic out of
NewContent and into a separate function to decrease the cyclomatic
complexity of NewContent.
2016-03-20 23:51:17 +01:00
Bjørn Erik Pedersen c21dc16dbe commands: Remove unused code 2016-03-14 15:24:42 +01:00
John Ku 0ab4162413 Ability to config layout and content dir via cli
fixes spf13/hugo#1598
2016-03-11 23:42:27 +01:00
Bjørn Erik Pedersen cafb784799 Add emoji support
This uses the Emoji map from https://github.com/kyokomi/emoji -- but with a custom replacement implementation.

The built-in are fine for most use cases, but in Hugo we do care about pure speed.

The benchmarks below are skewed in Hugo's direction as the source and result is a byte slice,
Kyokomi's implementation works best with strings.

Curious: The easy-to-use `strings.Replacer` is also plenty fast.

```
BenchmarkEmojiKyokomiFprint-4  	   20000	     86038 ns/op	   33960 B/op	     117 allocs/op
BenchmarkEmojiKyokomiSprint-4  	   20000	     83252 ns/op	   38232 B/op	     122 allocs/op
BenchmarkEmojiStringsReplacer-4	  100000	     21092 ns/op	   17248 B/op	      25 allocs/op
BenchmarkHugoEmoji-4           	  500000	      5728 ns/op	     624 B/op	      13 allocs/op
```

Fixes #1891
2016-03-11 15:51:37 -06:00
Bjørn Erik Pedersen c8c6f5d05b Add json mime extension type 2016-03-06 14:10:06 +01:00
Bjørn Erik Pedersen 80e1fd29ab Log fsync errors 2016-03-01 16:38:56 +01:00
Bjørn Erik Pedersen 1f61f40328 Use flagChanged in all places 2016-02-27 18:01:01 +01:00
Bjørn Erik Pedersen 9349a889e2 Do not try to find available port if set by user
He/she probably really meant it.

Fixes #1901
2016-02-27 16:58:42 +01:00
Bjørn Erik Pedersen 8c84048033 Force full rebuild when site config changes
Fixes #1840
2016-02-14 15:16:55 +01:00
Henrique Dias ad176055d9 Export MainSite var
Fixes hacdias/caddy-hugo#46
2016-02-14 13:50:03 +01:00
Anthony Fok 2d11551c53 Ignore temporary file "4913" created by Vim 2016-02-13 00:03:29 +08:00
Anthony Fok 1f326ad914 Fix bash-completion for Hugo builder flags such as --theme
by placing their SetAnnotation() calls after their definitions.

See #1824 and 87ca0d0
2016-02-06 23:49:45 +08:00
Bjørn Erik Pedersen eebf00f702 Re-export HugoCmd
Caddy depends on it.

Fixes #1827
2016-02-06 12:40:16 +01:00
Bjørn Erik Pedersen 61197f9f29 Order the hugo comand flag vars 2016-02-05 23:25:07 +01:00
Bjørn Erik Pedersen 74539dea87 Unexport the remaining vars in hugo command 2016-02-05 22:58:17 +01:00
Cameron Moore a89b2f41d6 commands: Get BaseURL from viper in server mode
Fixes #1821
2016-02-05 20:38:02 -06:00
Bjørn Erik Pedersen 3b596b85d1 Add renderToMemory flag
Only useful for benchmark testing as the rendered content will be ... invisible.
2016-02-05 21:30:48 +01:00
Bjørn Erik Pedersen 87ca0d0cbe Clean flags
* Reduce the amount of global flags
* Unexport all flag vars and commands vars
* Some other minor flag cleaning
2016-02-05 21:18:45 +01:00
Anthony Fok ca0c67dc69 Fix a minor typo discovered by Lintian (Debian) 2016-01-30 16:46:48 +08:00
Steve Francia d158f7e339 Provide more detail on static sync when running with verbose 2016-01-29 16:54:33 -05:00
Anthony Fok e8eb618166 Do not call watchConfig() when not in watch mode
See #1772

Also, force DisableLiveReload to true when running "hugo --watch"
(build-only non-server mode) to prevent livereload.ForceRefresh(),
which would end up blocking watchConfig() forever, from being called
because livereload.Initialize() is never called in this case.

This fixes the bug where "hugo --watch" could only reload config.toml
once before it gets stuck for good at livereload.ForceRefresh().

This is also consistent with Hugo's existing behaviour:
Non-server "hugo --watch" has never injected livereload.js
since the inception of the "watch" feature in Hugo v0.12.
2016-01-29 16:21:55 -05:00
Steve Francia c438f45629 Add flag --cleanDestinationDir=false to retain prior behavior 2016-01-29 16:14:23 -05:00
Bjørn Erik Pedersen 5def6d9aee Make the watch logger less chatty 2016-01-28 15:33:41 +01:00
Bjørn Erik Pedersen 12876ec991 Fix hugo benchmark
Appending to the site 13 times doesn't sound realistic.
2016-01-27 22:28:05 +01:00
Steve Francia d08e4c87a7 Rewrite commentary on static event handling 2016-01-26 14:56:42 -05:00
Steve Francia b0b4b82165 Permit directory removal during static sync 2016-01-26 14:33:56 -05:00
Steve Francia db18fd1582 Ignore .DS_Store changes (thumbnail cache file on mac) 2016-01-26 14:33:51 -05:00
Steve Francia 9413cf8499 Handle self rename operations gracefully 2016-01-26 14:33:08 -05:00
Steve Francia 74c90553b4 Static file incremental sync improvements
in tandem with Afero improvements
2016-01-26 14:31:43 -05:00
Steve Francia 7e196a8294 Handle remove & rename source operations incrementally 2016-01-26 14:30:28 -05:00
Steve Francia 9f3796a31d Read/reread individual source content files
next is incremental conversion
2016-01-26 14:26:23 -05:00
Steve Francia ca6ca4f4fc Separate handling content, data and template changes
Data & Templates reading independently
Need to work on page source reading and other source files
2016-01-26 14:25:39 -05:00
Steve Francia f3aa93fa48 Ignore temp files created by IntelliJ when saving 2016-01-25 14:41:47 -05:00
Steve Francia ed3015c350 update server to match latest afero 2016-01-11 21:45:05 -05:00
Ivan Fraixedes 9a6dc6c791 Add embeded template for robots.txt 2016-01-05 23:36:16 +01:00
Gerben Castel 6cdb8109cf Allow renaming of sitemap.xml 2016-01-04 12:28:49 -05:00
Fabiano Frizzo 8f6f13104e Copy static files changed
Fix watcher copy static theme files for
changed files

See #1644 #1559
2016-01-04 10:32:21 -05:00
digitalcraftsman 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
Steve Francia 1d6286b094 update to use cobra's sub package doc 2015-12-24 10:31:44 -05:00
Fabiano Frizzo a291f3c5d9 Copy only the static files changed
Update on the watcher copy static to copy only the
changed files and add an flag forceSyncStatic to
copy all statics always a static is changed

See #1644 #1559
2015-12-23 18:49:06 -05:00
Steve Francia 277425bada Ignore temp files created by IntelliJ when saving 2015-12-23 17:45:39 -05:00
Anthony Fok e1af7cb9d0 Use MkdirAll instead of Mkdir in hugo gen doc
Also print a feedback if the path does not exist and needs to be created.
2015-12-19 06:08:01 -07:00
Anthony Fok 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
Anthony Fok 3574304c68 Improve some random feedback messages
Also clean up a couple random comments.
2015-12-16 21:26:51 -07:00
Anthony Fok 9c39593dee Move cobra.MousetrapHelpText to hugo_windows.go
Fix build error due to Cobra API change, see
spf13/cobra#195: Compile mousetrap only on Windows
2015-12-16 21:26:47 -07:00
Anthony Fok c1e134f1c2 Add --source flag back to hugo new command
v0.15 had it, but I removed it inadvertently for 0.16-DEV
in commit 00d04774 in PR #1652.

Also add directory bash-completion for `--source`
for `hugo convert`, `hugo list` and `hugo new`.

See #1624, #1589
2015-12-16 00:00:05 -07:00
Bjørn Erik Pedersen d1bec54293 Do not fail on unknown Jekyll file
Fixes #1705
2015-12-14 15:30:58 +01:00
Anthony Fok 8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07:00
Steve Francia e29ede7055 Fix some of the "new site" tests 2015-12-08 17:38:48 -05:00
Bjørn Erik Pedersen 56d6c0be5a Turn off failing new site test
Until @spf13 gets some free time in his busy calendar.

See #1680
2015-12-08 19:25:34 +01:00
Bjørn Erik Pedersen 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
inondle f6fdfcd429 Added 'themes' as a default new site directory
Fixes #1507
2015-12-04 02:19:53 -07:00
Anthony Fok cd062623bd Fix crash with "config", "check" and "benchmark"
The crash was introduced by commit 00d04774 in PR #1652
where access to NoTimes was attempted even though --noTimes
was not defined for the config, check and benchmark commands.

Special thanks to @bep for the heads-up!

See also #1624 - CLI UX: Flags shouldn't be global
2015-12-03 12:02:38 -07:00
Anthony Fok c1b5a48f4e Add sanity checks for hugo import jekyll
Also add `--force` flag copied from `hugo new site`.

Fixes #1625
2015-12-03 00:39:00 -07:00
Anthony Fok 00d04774f0 Change most global flags into local ones
This is to ensure that only the relevant command-line flags
for a certain Hugo subcommand is shown to the end user,
reducing clutter and improving user experience.

Fixes #1624 - CLI UX: Flags shouldn't be global
2015-12-03 00:36:38 -07:00
Anthony Fok c9526f6e3f Revise format for "Unable to locate Config file" error 2015-12-03 00:28:09 -07:00
Bjørn Erik Pedersen be28d9d943 Fix some errors with format patterns
See #1502
2015-12-02 23:37:40 +01:00
Anthony Fok d48781badf One more error fix in the server command
And some other small code clean-up.

See #1502
2015-12-02 11:56:36 -07:00
Bjørn Erik Pedersen c5287e7817 Some more error fixes in commands
See #1502
2015-12-02 16:27:08 +01:00
Bjørn Erik Pedersen 3f0f7eed68 Improve error handling in commands
Cobra, the CLI commander in use in Hugo, has some long awaited improvements in the error handling department.
This enables a more centralized error handling approach.

This commit introduces that by changing all the command funcs to `RunE`:

* The core part of the error logging, usage logging and `os.Exit(-1)` is now performed in one place and that one place only.
* The usage text is now only shown on invalid arguments etc. (user errors)

Fixes #1502
2015-12-02 07:07:05 -07:00
Anthony Fok 75c61236f1 Move import jekyll functions to import_jekyll.go
Also rename import_test.go to import_jekyll_test.go
2015-12-02 03:39:10 -07:00
Anthony Fok 666ddd2377 Enable dirname and filename completion for more flags
These flags are:

 * --source (-s), --cacheDir, --destination (-d) and --logFile
 * --completionfile and --dir.
2015-12-02 02:24:49 -07:00
Anthony Fok afbc18c09a Bump min_version to 0.15 for hugo new theme 2015-12-01 10:27:36 -07:00
Tatsushi Demachi e989468341 Make noTimes command flag work
Hugo command provides "noTimes" flag but it doesn't affect synced files
timestamp regardless of whether the flag is specified or not.

This fixes it by adding a flag check and overwriting configuration if it
is specified.

Fix #1583
2015-12-01 10:01:44 -07:00
Tatsushi Demachi 6c8103144f Copy static dir files without theme's static dir
Hugo command doesn't copy site's "static" directory files to "public"
directory if a specified theme doesn't have "static" directory because
theme's "static" directory checking always returns an error.

This fixes it by just showing a warning message about theme's "static"
directory absence and not skipping following processes.

Fix #1655
2015-12-01 10:01:21 -07:00
Anthony Fok 50b5d0af29 Support setting target directory in hugo gen man
Fixes #1627
2015-11-28 07:32:02 -07:00
Steve Francia f045d7a611 Change the license to Apache 2.0 2015-11-23 22:16:36 -05:00
Andrew Brampton c3931ef748 Add PygmentsOptions option
This allows default pygments settings to be used, if none are explictly set per shortcode.

Fixes #1260
2015-11-23 17:50:54 +01:00
Bjørn Erik Pedersen 3d09de8910 Restructure the gen commands
Fixes #1603
2015-11-23 16:51:12 +01:00
Bjørn Erik Pedersen 831e936846 Improve "watching for ..." logging 2015-11-23 16:32:06 +01:00
Anthony Fok 098a0c819a Add commands/genman.go to autogenerate man pages
Fixes #1369
2015-11-22 18:54:44 +01:00
Anthony Fok 5c7234015d Copyedit long help message in commands/server.go 2015-11-21 06:31:10 -07:00
Steve Francia 97d0689580 Hugo server watch by default 2015-11-20 10:14:24 -05:00
Bjørn Erik Pedersen 3f5ddd5242 Revert "Disable render-to-memory on Windows"
This reverts commit 91e0c2b1fe.

This should now work.
2015-11-19 19:48:40 +01:00
Bjørn Erik Pedersen 91e0c2b1fe Disable render-to-memory on Windows
See #1586
2015-11-18 23:10:56 +01:00
Bjørn Erik Pedersen 4679fbee41 Do not rebuild on extra Spotlight filesystem events
Write and rename operations are often followed by CHMOD.
There may be valid use cases for rebuilding the site on CHMOD,
but that will require more complex logic than this simple conditional.

On OS X this seems to be related to Spotlight, see:
https://github.com/go-fsnotify/fsnotify/issues/15

A workaround is to put your site(s) on the Spotlight exception list,
but that may be a little mysterious for most end users.

So, for now, we skip reload on CHMOD.

This small commit will be a 100% improvement for most OS X-users.

Fixes #1587
2015-11-18 22:59:32 +01:00
spf13 df824fa31b Hugo server renders and serves from memory by default (30%+ improvement) 2015-11-16 22:00:11 -05:00
spf13 e1618e9d2f permit the notimes flag on hugo server 2015-11-16 21:56:14 -05:00
spf13 cb48425f2d No double slash when destination set to '/' 2015-11-16 21:56:14 -05:00
spf13 ef0b9b511c Handle sync (file copy) errors better) 2015-11-16 21:56:14 -05:00
Anthony Fok 18a29964fa Fix trivial typos in code 2015-11-16 07:15:17 -07:00
spf13 a50133ff38 Improve the server usage output 2015-11-12 10:23:41 -05:00
Bjørn Erik Pedersen 3bbd02a1ca Print parse errors from Viper 2015-11-11 22:47:24 +01:00
spf13 bccf957e36 Add support for dynamic reloading of config file when watching 2015-11-09 23:31:52 -05:00
Arun Sori 83e46555dd Disable directory listing for Hugo file server
Fix #1400
2015-10-31 09:23:30 -06:00
Bjørn Erik Pedersen 9d603ce88a Show usage when new site creation fails 2015-10-17 14:08:45 +02:00
Bjørn Erik Pedersen ab7223df8c Improve error message on new site command 2015-10-17 14:05:48 +02:00
Safonov Nikita 5e97cf3020 Add force flag
If flag is passed the site will be created inside non-empty folder
only if there are no existent folders or config with the same name
hugo creates.

Resolves: #1163
2015-10-17 13:58:43 +02:00
Kato Kazuyoshi 3a412543f6 The missing static directory shouldn't fail the build
The lack of the directory would be worth to warn, since the directory is
created by "huge new site". But it doesn't have to fail the build.

This change fixes #759.
2015-10-17 13:50:37 +02:00
Andy Williams 0f438d1852 Create minimal default.md in archetype file
fixes #315
To fix the cast error, create a minimal default.md in the archetype
folder.
2015-10-15 16:36:13 -04:00
Bjørn Erik Pedersen 72f14a8202 Apply project wide go fmt 2015-10-12 20:47:06 +02:00
Bjørn Erik Pedersen 63d9859c09 Expose canonifyURLs as a command flag
Needed by the theme site.
2015-10-10 10:53:13 +02:00
coderzh 823334875d WordCount and Summary support CJK Language
* add global `hasCJKLanguage` flag, if true, turn on auto-detecting CJKLanguage
 * add `isCJKLanguage` frontmatter to force specify whether is CJKLanguage or not
 * For .Summary: If isCJKLanguage is true, use the runes as basis for truncation, else keep as today.
 * For WordCount: If isCJKLanguage is true, use the runes as basis for calculation, else keep as today.
 * Unexport RuneCount

Fixes #1377
2015-10-07 15:14:57 +02:00
Bjørn Erik Pedersen b25ba8b095 Let Cobra do the usage error logging
Fixes #1472
2015-10-05 20:26:49 +02:00
Bjørn Erik Pedersen b9aaa0079b Improve command text for import command 2015-10-05 11:25:42 +02:00
Bjørn Erik Pedersen ac1e3c3cc0 Capital J in Jekyll 2015-10-04 23:26:18 +02:00
coderzh 9a2f6c62a6 Hugo import from jekyll
usage: hugo import jekyll jekyll_root_path target_path

Implemented:
 * Create new hugo site
 * Create config.yaml
 * Convert all markdown contents.
 * Copy all other files and folders to static

Fixes #101
2015-10-04 20:02:53 +02:00
Bjørn Erik Pedersen 218554e363 Rename NormalizeHugoFlagsFunc to NormalizeHugoFlags
It IS a func.
2015-10-02 06:48:02 +02:00
Anthony Fok b29ca44c6e Show both baseURL and bind address in hugo server output
Fixes #1426
2015-09-15 23:12:01 -06:00
Bjørn Erik Pedersen f5308da320 Move isThemeVsHugoVersionMismatch to /commands
To prevent potential package cycles in /helpers.
2015-09-14 17:31:39 +02:00
Anthony Fok d05b297e61 Add helpers.NormalizeHugoFlagsFunc() to handle flag name changes
It currently handles --baseUrl to --baseURL, and --uglyUrls to --uglyURLs.

Special thanks to Eric Paris (@eparis) for writing the
"normalized name" support in Cobra, and for showing us
how it is used in Kubernetes.

See Issue #959
2015-09-13 05:20:14 -06:00
digitalcraftsman fd7b315572 Add a 404.html file if a new theme is created 2015-09-08 11:29:04 -04:00
chrongzhang 52d94fa675 Add config option "disablePathToLower"
Enabling this prevents lowercasing of the path/url.

Fixes #557
2015-09-01 15:26:02 +02:00
Anthony Fok 4047ca5c3c Search current directory for config file by default
As of 2015-08-16, Viper no longer searches the CWD
for config file by default to avoid unintended surprises,
but Hugo relies on the original behaviour.

Fixed by calling

    viper.AddConfigPath(".")

at the appropriate place.

See https://github.com/spf13/viper/issues/73 for more information.

Fixes #1363
2015-08-19 00:36:22 -06:00
Anthony Fok 29c9a40a8d Implement hugo --theme=[Tab][Tab] bash completion
using the new BashCompSubdirsInDir annotation in spf13/cobra.
2015-08-11 15:08:10 +02:00
Anthony Fok 7555e364d0 Print feedback for hugo genautocomplete 2015-08-09 17:59:44 +02:00
Anthony Fok c69835daba Print feedback for hugo gendoc 2015-08-09 17:58:01 +02:00
Anthony Fok fee5519129 Use spf13/pflag's new SetAnnotation helper
And make our bash completion code more compact.
2015-08-09 17:56:15 +02:00
Bjørn Erik Pedersen b05a292c21 Revert "Fix some Go code doc issues"
This reverts commit de7dd70bbc.

Broke the code fence feat.
2015-08-07 20:09:40 +02:00
Bjørn Erik Pedersen de7dd70bbc Fix some Go code doc issues 2015-08-06 22:58:10 +02:00
Anthony Fok f2ab0b2608 Improve formatting of Hugo command descriptions
Trying to make them look good both in the terminal (`hugo help [command]`)
and in the web browser (http://gohugo.io/commands/).  :-)
2015-08-04 03:19:57 -06:00
Anthony Fok e64e571b67 Bump hugo new theme template min_version to 0.14 2015-08-04 02:59:57 -06:00
Scott C Wilson 72ecd0cdc7 Ignore non-presence of "layouts" directory in watch logic
Fixes #691
2015-07-25 21:50:24 +02:00
Scott C Wilson c00a1fcb7f Add a check for the setting of watch flag in config file
Fixes #1074
2015-07-20 14:20:07 +02:00
Bjørn Erik Pedersen 354192d2b8 Log missing theme as FATAL
See #1234
2015-07-13 10:38:28 +02:00
Scott C Wilson 029cdb68f5 Checks to ensure theme directory, if specified, exists
See #1234
2015-07-13 10:31:59 +02:00
Andrew Brampton c139c6e1ef Add support for GitHub-flavoured markdown code fences for highlighting
This commit adds a new PygmentsCodeFences config option (default false), which if true will allow GitHub style backtick code fences around code, which will then be rendered by Pygments.

For example:

``` language
your code
```

can be used instead of {{< highlight language >}}your code {{< /highlight >}}.

Fixes #362
2015-07-08 08:12:52 +02:00
Bjørn Erik Pedersen 033a13e10e Fix watcher detecting changes as static when no theme
There have been some changes to the ´helpers.GetThemesDirPath()´ so it now returns an empty string when no theme.

This is correct, but it broke the watch service (at lest on OSX), as `strings.HasPrefix("", "somestring") evaluates to true somehow, and content changes are incorrectly branded as static.

There are other issues in there, but that will come later ...

See #1236
2015-06-28 19:27:28 +02:00
Bjørn Erik Pedersen 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 be38acdce7 Add PreserveTaxonomyNames flag
Before this commit, taxonomy names were hyphenated, lower-cased and normalized -- then fixed and titleized on the archive page.

So what you entered in the front matter isn't necessarily what you got in the final site.

To preserve backwards compability, `PreserveTaxonomyNames` is default `false`.

Setting it to `true` will preserve what you type (the first characters is made toupper for titles), but normalized in URLs.

This also means that, if you manually construct URLs to the archive pages, you will have to pass the Taxonomy names through the `urlize` func.

Fixes #1180
2015-05-31 20:30:53 +02:00
bep be2842da18 Fix formatting in hugo command description 2015-05-21 20:05:29 +02:00
bep be831d7409 Fix CLI command description for the top level
And regenerate the commands doc.
2015-05-21 13:30:11 +02:00
spf13 fd5cf9ac8d Better organization of loading defaults 2015-05-20 18:50:32 -04:00
spf13 a584ff207b Stop Viper from leaking across many of the tests (now tests pass regardless of order tested) 2015-05-20 02:21:21 -04:00
bep 599d1b9786 Add gendoc command
Using the new, great auto-doc in Cobra.

This commit also contains a current result of that command added to a commands section in docs.

Fixes #1136
2015-05-19 10:57:21 -04:00
bep befa26b152 Remove trailing spaces in completionfile flag 2015-05-16 19:52:09 +02:00
bep be9224d720 Add Bash completion
Add a new command, genautocomplete, wich generates a Bash completion script (zsh and others later).

The script is by default written to `/etc/bash_completion.d/hugo.sh`; this can be set in `--completionfile=/some/file`.

Fixes #438
2015-05-16 18:04:59 +02:00
Andre R 84f4c21d4a Fix datePublished to publishdate 2015-05-16 15:58:37 +02:00
bep bee9718ac1 Do not shout about missing baseURL if relativeURLs is set 2015-05-16 15:42:15 +02:00
bep beaa8b1bca Add support for URLs relative to context root
Setting `RelativeURLs` to `true` will make all relative URLs in the site *really* relative.

And will do so with speed.

So:

In `/post/myblogpost.html`:

`/mycss.css` becomes `../mycss.css`

The same in `/index.html` will become:

`./mycss.css` etc.

Note that absolute URLs will not be touched (either external resources, or URLs constructed with `BaseURL`).

The speediness is about the same as before:

```
benchmark                    old ns/op     new ns/op     delta
BenchmarkAbsURL              17462         18164         +4.02%
BenchmarkAbsURLSrcset        18842         19632         +4.19%
BenchmarkXMLAbsURLSrcset     18643         19313         +3.59%
BenchmarkXMLAbsURL           9283          9656          +4.02%

benchmark                    old allocs     new allocs     delta
BenchmarkAbsURL              24             28             +16.67%
BenchmarkAbsURLSrcset        29             32             +10.34%
BenchmarkXMLAbsURLSrcset     27             30             +11.11%
BenchmarkXMLAbsURL           12             14             +16.67%

benchmark                    old bytes     new bytes     delta
BenchmarkAbsURL              3154          3404          +7.93%
BenchmarkAbsURLSrcset        2376          2573          +8.29%
BenchmarkXMLAbsURLSrcset     2569          2763          +7.55%
BenchmarkXMLAbsURL           1888          1998          +5.83%

```

Fixes #1104
Fixes #622
Fixes #937
Fixes #157
2015-05-16 00:11:44 +02:00
bep be3a3506c4 Allow forward slashes in Hugo new on Windows
Fixes  #1133
2015-05-12 18:12:58 +02:00
bep bef0f281d1 Make sure that complete server URL is logged on startup
Fixes #1113
2015-05-09 08:03:06 +02:00
Joel Scoble b4871787f0 add undraft command 2015-05-08 22:18:51 -04:00
bep d4acacd4f5 Section menu for the lazy blogger
The current menu system works great, but is too much work if all you want is a simple menu with the sections as menu items, and having these menu items connected to the pages in a way that enables setting the correct menu item as active for both the section lists and the pages itself.

This commit adds a new option `SectionPagesMenu' which, if set, will create a new menu with that name with all the sections as menu items. The pages in the sections will behave as "shadow members" of these section items as `blogpage.HasMenuCurrent "sectionmenu" $sectionmenuitem` will return true.

If a menu item with the same `identifier` is defined in site config, *that* item will take precedence.
2015-05-08 21:28:19 -04:00
Dana H. P'Simer fd08e16ec8 Add RSSUri to specify the name of the RSS file 2015-05-07 22:20:00 +02:00
Liam Bowen 2bfa9fb72b Make server bind interface configurable.
Bind by default to 127.0.0.1. Previously it always bound to all interfaces.

Always have log message display that the server is available on the
interface to which it is bound, instead of the baseUrl.

Fixes #1097
2015-05-07 22:04:40 +02:00
bep bee521c68f Try to make it more visible that you have to set baseUrl 2015-05-02 00:24:47 +02:00
bep be29c0bfbd Print ERROR on theme vs Hugo version mismatch
Fixes #1070
2015-04-28 20:39:25 +02:00
bep bebb1b9d5d Fix spelling mistake in comment 2015-04-07 15:17:24 +02:00
bep be31b9e287 Add custom Windows mousestrap message
Fixes #1022
2015-04-07 13:01:11 +02:00
bep be57ec5331 Fix the last Go Vet error 2015-04-03 22:18:08 +02:00
Dylan MacKenzie 99a18b21fc List directories being watched when server is run
Fixes part of issue 1030. Previously hugo only listed the content
directory as being watched. Now we list all files being watched
according to `commands.getDirList()`. We also introduce a RemoveSubpaths
function and test in the helpers module to reduce noise in the command
line output by not showing subdirectories of ones already being watched.

For example, instead of:
`Watching for changes in $HOME/blog/content`
We get:
`Watching for changes in
$HOME/blog/{data,content,layouts,static,themes/my-theme}`
2015-04-02 12:52:08 +02:00
bep beaf5db3ff Use helpers.FilePathSeparator const 2015-03-28 21:46:06 +01:00
Nuno Antunes 61a02c4df8 Fix section name guessing on Windows 2015-03-28 21:43:55 +01:00
bep 3273fce044 Refactor Hugo version
Put version handling into the helpers package so it can be used by many,
and split version and suffix to make it possible to calculate the next Hugo version.
2015-03-18 12:23:13 +01:00
Anthony Fok 8b8fb417ae More initialism corrections (golint)
Thanks to @bep's new, brilliant helpers.Deprecated() function,
the following functions or variables are transitioned to their
new names, preserving backward compatibility for v0.14
and warning the user of upcoming obsolescence in v0.15:

 * .Url → .URL (for node, menu and paginator)
 * .Site.BaseUrl → .Site.BaseURL
 * .Site.Indexes → .Site.Taxonomies
 * .Site.Recent → .Site.Pages
 * getJson → getJSON
 * getCsv → getCSV
 * safeHtml → safeHTML
 * safeCss → safeCSS
 * safeUrl → safeURL

Also fix related initialisms in strings and comments.

Continued effort in fixing #959.
2015-03-18 11:30:37 +01:00
bep fbcda03029 Do not ERROR-log missing /data dir
Fixes #930
2015-03-12 21:44:36 +01:00
Anthony Fok 67df33f500 Correct initialisms as suggested by golint
First step to use initialisms that golint suggests,
for example:

    Line 116: func GetHtmlRenderer should be GetHTMLRenderer

as see on http://goreportcard.com/report/spf13/hugo

Thanks to @bep for the idea!

Note that command-line flags (cobra and pflag)
as well as struct fields like .BaseUrl and .Url
that are used in Go HTML templates need more work
to maintain backward-compatibility, and thus
are NOT yet dealt with in this commit.

First step in fixing #959.
2015-03-11 21:55:00 +01:00
Anthony Fok b9b70fb6b0 Skip directories like node_modules from the watchlist
A local `node_modules` directory can easily contain
tens of thousands of files, easily exhausting the tiny
default max open files limit especially on OS X Yosemite,
in spite of the fact that  Hugo already had code in place
since February 2014 to try to raise the maxfiles ulimit.

Also skip `.git` and `bower_components` directories.

The file watching situation will improve when
https://github.com/go-fsnotify/fsevents become ready,
but until then, we will be thrifty.  :-)

Thanks to @chibicode for the suggestion.

See #168 for continued discussions.
2015-03-10 16:55:23 -06:00
Anthony Fok 81695717e6 Switch from fsnotify.v0 to fsnotify.v1 API (watcher)
Fixes #357
See also #761
2015-03-10 09:59:55 -06:00
Anthony Fok 634548b9af Add new min_version field to theme.toml template 2015-03-10 09:49:42 -06:00
bep e685dfc0c6 Apply some more Golint suggestions 2015-03-06 18:07:50 +01:00
bep 224a2ddf3c Fix some Go Lint errors 2015-03-06 15:58:14 +01:00
bep 103ea842f8 Fix errors reported by Go Vet 2015-03-06 15:25:19 +01:00
bep 967d001ebe Use osext on GitHub
Fixes #922
2015-02-23 18:12:19 +01:00
René Jochum d2e022f2a7 Suppress errors for symbolic links witch point to a file. 2015-02-17 19:18:28 -08:00
Cyrill Schumacher 32d645d900 Fix bug where running hugo without options causes to create
$TMPDIR/hugo_cache/ directory.
2015-02-17 12:14:39 -05:00
Cyrill Schumacher 10c2b41b85 Add --ignoreCache CLI flag with description "Ignores the
cache directory for reading but still writes to it" as @spf13
suggested.
2015-02-17 12:14:39 -05:00
Cyrill Schumacher 5e2d3d2e10 Merge to stay up to date with current dev
Feature: GetJson and GetJson in short codes or other layout files.
For more details please see: http://cyrillschumacher.com/2014/12/21/dynamic-pages-with-gohugo.io/
2015-02-17 12:14:39 -05:00
Anthony Fok 9bf223e584 Quote strings in hugo config output
Also, use ` = ` to separate keys and values
if metaformatdata is "toml".
2015-02-17 11:51:43 +01:00
Anthony Fok 54e417681d Make "Indexes" the alias and "Taxonomies" the canonical name
... rather than the other way around.
Discovered thanks to the new `hugo config` command.
2015-02-16 13:16:17 -07:00
bep c14e7b10d0 Add 'config' command to list site configuration
Fixes #871
2015-02-14 18:33:47 -05:00
spf13 d6f81c7346 Put back static theme conditional 2015-02-14 18:30:15 -05:00
Anthony Fok d10e05f2e3 [commands/new.go] Update theme.toml etc.
- Add copyright years and author to the top of the file

- Write the current year from time.Now() to LICENSE.md

- Correct comment regarding `os.MkdirAll(p, 0777)`

- In createConfig(), split the `map[string]string` definition into
  multiple lines to facilitate future expansion.  Also add a trailing
  slash to sample "baseurl" definition.

- Update theme.toml template to match that listed at
  https://github.com/spf13/hugoThemes/blob/master/README.md#themetoml

  See #883 for an equivalent `struct` implementation
2015-02-13 15:00:17 -07:00
bep 1217632307 Remove now superfluous conditional 2015-02-12 00:09:04 +01:00
bep ebcc1e6699 Add data files support in themes
If duplicate keys, the main data dir wins.

Fixes #892
2015-02-11 20:24:56 +01:00
Anthony Fok 664fd99135 Change "ctrl+c" to "Ctrl+C" 2015-02-11 01:11:50 -07:00
Erlend Klakegg Bergheim 773812de6f Reads data files inside data/ and makes data available in .Site.Data
Fixes #476.

Conflicts:
	hugolib/site.go
2015-02-09 13:17:13 +01:00
bep 5e34ae6199 Log ERROR on missing baseurl
Fixes #877
2015-02-06 10:39:54 +01:00
bep 5df85770fc Add memprofile to pprof benchmark 2015-02-05 15:48:09 +01:00
Naoya Inada d1364ffb68 Fix defaults for Blackfriday 2015-01-31 22:06:50 +01:00
Dan Hersam 523f38a9a8 Fix for issue 839 and 490 on Windows
The paths were seen as changed but not static because of the backslashes in
ev.Name. Once the backslashes were added, I discovered that the JSON
sent to livereload was invalid and failed to work because it had backslashes.

Hence the code to replace the backslashes from the path to make them work
in JSON and for the URL.

With this fix, changes to a stylesheet are shown on the page, and if it's a
single file that changed, it's reflected in the browser without reloading the whole
page.
2015-01-30 14:18:17 +01:00
Dan Hersam 2d8e15a565 Version uses binary name instead of hugo
On Windows the binary name is hugo.exe and running hugo version results in
this error:
    GetFileAttributesEx D:\Dev\Go\gopath\bin\hugo: The system cannot find the file specified.

This fixes that error and allows the binary name to be something other
than hugo on any OS.
2015-01-28 09:43:12 +01:00
bep fb594fc6e0 Set detault for Paginate to 10
10 is a better default than 0, since no paginator pages will be created unles referenced by a `.Paginator`.

See #750
2015-01-26 15:26:19 +01:00
bep 37445bc6aa Add pagination support for home page, sections and taxonomies
Two new configuration properties, `Paginate` (default `0`) and `PaginatePath` (default `page`) are added.

Setting `paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of size of the `paginate` property.

A `.Paginator` is provided to help building a pager menu.

There are two ways to configure a `.Paginator`:

1. The simplest way is just to call `.Paginator.Pages` from a template. It will contain the pages for "that page" (`.Data.Pages` will (like today) contain all the pages).
2. Select a sub-set of the pages with the available template functions and pass the slice to `.Paginate` : `{{ range (.Paginate (where .Data.Pages "Type" "post")).Pages }}`

**NOTE:** For a given Node, it's one of the options above. It's perfectly legitimate to iterate over the same pager more than once, but it's static and cannot change.

The `.Paginator` contains enough information to build a full-blown paginator interface.

The pages are built on the form (note: BLANK means no value, i.e. home page):

```
[SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/1/index.html => redirect to  [SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/2/index.html
....
```

Fixes #96
2015-01-26 12:59:37 +01:00