Commit graph

159 commits

Author SHA1 Message Date
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
Naoya Inada
407e80a9ab Add site-wide/per-page [blackfriday] extensions option 2015-01-26 09:55:37 +01:00
Anthony Fok
eb686352b1 Add site-wide/per-page [blackfriday] fractions option
Make Blackfriday's `HTML_SMARTYPANTS_FRACTIONS` option
user-configurable.  Defaults to `true` as before.  See
discussions at:

http://discuss.gohugo.io/t/any-way-to-disable-smart-fractions/328

Thanks to @bjornerik and @spf13 for laying the groundwork
making it easy to expose Blackfriday's underlying configurable
options.
2015-01-24 20:57:40 +01:00
Anthony Fok
60c6faa317 Revert "Try to fix mysterious test failures on Travis"
This reverts commit 71fe85df9b.

See https://github.com/PuerkitoBio/purell/pull/5
for the cause of the mysterious `go test -v ./...` failure.
2015-01-22 17:46:47 -07:00
bep
71fe85df9b Try to fix mysterious test failures on Travis 2015-01-23 00:36:47 +01:00
Derek Perkins
ac6b86aff8 Added top level .Hugo variable with version, commit and generator information + docs
Added Version, CommitHash and BuildDate to hugolib/hugo.go and used it in build
Removed commitHash and buildDate from commands/version.go and used hugolib vars
Removed getDateFormat function from commands/version.go

Conflicts:
	README.md
	docs/content/templates/variables.md
2015-01-19 01:22:23 +01:00