Commit graph

119 commits

Author SHA1 Message Date
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
208086ebff Add ".swx" suffix to file watcher's ignore list
When a user uses Vim to open a file, it briefly creates a
".filename.md.swx" file which needlessly triggers a website rebuild.

According to a comment in Vim's src/memline.c:

    /*
     * on MS-DOS compatible filesystems (e.g. messydos) file.doc.swp
     * and file.doc are the same file. To guess if this problem is
     * present try if file.doc.swx exists. If it does, we set
     * buf->b_shortname and try file_doc.swp (dots replaced by
     * underscores for this file), and try again. If it doesn't we
     * assume that "file.doc.swp" already exists.
     */
2015-01-14 19:29:56 -07:00
bep
2b46f3e51e Do not exit server watch on error
Before this commit any error (typically a YAML typing error in front matter) would exit server on rebuild when running `hugo server -w`.

This is very annoying as it doesn't give you any chance to fix the typo other than doing a manual restart.

This commit fixes that by just logging these errors when these rebuilds happen when changes are detected.

Fixes #781
2015-01-09 12:40:48 +01:00
Jacob Gillespie
c0f54aefe3 Rename to plainIdAnchors 2015-01-05 21:00:22 +01:00
Jacob Gillespie
4adf58cce7 Group both options under Blackfriday: documentIDAnchor 2015-01-05 21:00:22 +01:00
Jacob Gillespie
b7716948bc Add config options: disable footnote anchor prefix and header ID suffix
New config options:

* DisableFootnoteAnchorPrefix - bool - default: false
* DisableHeaderIDSuffix - bool - default: false
2015-01-05 21:00:22 +01:00
bep
fbf8bcacc4 Add configurable support for angled quotes
The flag `HTML_SMARTYPANTS_ANGLED_QUOTES` was added to Blackfriday on Black Friday. This configures rendering of double quotes as angled left and right quotes («
»).

Typical use cases would be either or, or combined, but never in the same
document. As an example would be a person from Norway; he has a blog in both
English and Norwegian (his native tongue); he would then configure Blackfriday
to use angled quotes for the Norwegian section, but keep them as reqular
double quotes for the English.

This commit adds configuration support for this new flag, configuration that can be set in the site configuration, but overridden in page front matter.

Fixes #605
2014-12-26 14:31:55 +01:00
Tatsushi Demachi
7436829b82 Use current working dir as WorkingDir instead of hugo executable's dir 2014-12-12 11:33:52 -05:00
Austin Ziegler
ec4b6c03a8 Trigger an editor after hugo new.
- Trigger permanently with NewContentEditor in config.{toml,yaml,json}.
- Trigger on an individual basis with --editor.
2014-12-12 11:33:52 -05:00
Ahsanul Haque
b11838da3f Commented commands package 2014-12-12 00:05:02 +06:00
bep
e6541c45ab ERROR-log on symbolic links
filepath.Walk does not follow symbolic links.
There's no easy fix for that outside of Go, so the best we can do for now is to give notice to the end user by ERROR log statements.

This commit also fixes a related panic situation in GenerateTemplateNameFrom when the layout dir was a symbolic link.

Fixes #283
2014-12-10 20:32:39 +01:00
spf13
92a3372a3f Added a new command hugo list drafts and hugo list future 2014-11-19 16:24:30 -05:00
Joel Scoble
05300fde1d add support for fsync's noTime flag 2014-11-13 22:32:27 -05:00
Kartik Singhal
f3e9cbc7bd Fix #593 problem with hugo -w 2014-11-02 00:44:55 -04:00
Austin Ziegler
c07b10bba9 Output a timestamp with hugo server --watch
Per a [discussion][thread] on discuss, I have implemented one possible
way to do this.

[thread]: http://discuss.gohugo.io/t/output-a-timestamp-with-hugo-watch/213
2014-11-02 00:29:11 -04:00
spf13
141f3e19e0 Migrating Hugo to Afero for filesystem calls. 2014-11-01 11:57:29 -04:00
spf13
20467e36b4 Improved error message when config file not found. 2014-10-16 20:20:39 -04:00
spf13
5dfc1dedb8 Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
Oscar Bolmsten
b98c2088f8 Minor fix to error message when copying static files 2014-10-07 17:17:51 -04:00
Austin Ziegler
e68e7ef96f Configure footnote rendering.
- The config file can provide FootnoteAnchorPrefix, which will be used
  by blackfriday when rendering to HTML. A value of `q:` has the effect
  of making the anchor for a footnote `[^footie]` be `fn:q:footie`. The
  default is `""`.

- The config file can provide FootnoteReturnLinkContents, which will be
  used by blackfriday when rendering to HTML. A value of `^` has the
  effect of making the return link be `^` instead of `[return]`.
2014-10-07 16:43:33 -04:00
Kartik Singhal
879e90dca7 Switch to new hompage 2014-10-02 13:39:59 -04:00
bep
df489b4712 Enable soft livereload of CSS and images
Prior to this commit a dummy JavaScript filename was sent to LiveReload when changing a static file (CSS, image etc.), forcing a full browser reload of the page.

This commit fixes this by sending the relative file path of the changed static resource, enabling partial live reloading for CSS- and image-changes. If more than one static file happens to end up in the same changeevent-batch, it will fall back to do a full refresh. To enable this logic, the change events with names ending with ".goutputstream*" is now filtered out as temporary.

Changes in dynamic content behaves like before.

Issue #490
2014-09-11 16:58:06 -04:00
Tatsushi Demachi
d9964451a5 More error messages at syncing static contents 2014-09-08 11:57:06 -04:00
spf13
4281cbfa34 LiveReloadDisabled works with Watching properly. Fixed #335. 2014-08-25 13:49:53 -04:00
Franklin Wise
5ae2832713 errors not propagating 2014-08-18 11:43:55 -04:00
spf13
bf9595aa24 Fixed #328. Config file set appropriately. 2014-07-01 10:59:58 -04:00
Kristoffer Grönlund
35d04671d3 Add PluralizeListTitles option (default true) to allow disabling use of the inflect package 2014-06-30 15:21:09 -04:00
spf13
b9bba2b977 Updating Convert to handle dates properly for yaml and json
Fix bug with YAML & JSON with handling dates with 'new' and 'convert'
2014-05-29 18:45:19 -04:00
spf13
c502f078bc Add handling for publishDates (which will be ignored if in the future). Fixed #260 2014-05-29 00:48:40 -04:00
spf13
9173022ea7 Set verbose to Info level 2014-05-27 18:29:55 -04:00
spf13
e799100395 Fix bug so watch works on theme directories as well 2014-05-27 18:29:15 -04:00
spf13
be1ee22032 Proper integration of live reload with automatic injection 2014-05-16 17:49:27 -04:00
spf13
60ed5bda2b Live reloading is working! Still need to incorporate cleanly. 2014-05-16 11:48:59 -04:00
LK4D4
2194cc77de Add pygmentsstyle and pygmentsuseclasses options
Fixes #204

Conflicts:
	commands/hugo.go
2014-05-09 23:20:11 -04:00
Vincent Batoufflet
6049c3a10c Update Sitemap default value syntax 2014-05-09 23:11:37 -04:00
Vincent Batoufflet
2a902bbca6 Add Sitemaps config values handling 2014-05-09 23:11:33 -04:00
Vincent Batoufflet
f8e675d064 Add base Sitemap support 2014-05-09 23:11:27 -04:00
spf13
28ffb92b36 Adding the new command and the create package 2014-05-02 01:06:01 -04:00
spf13
3395e1cb92 Adding a command that enables converting site to a different metadata format.
Doing this revealed some bugs in the encoding functionality in some of the underlying libraries.
Please backup before using.
2014-05-01 13:23:32 -04:00
spf13
41adafbc3e Updated to work with the latest viper 2014-04-10 14:24:18 -04:00
spf13
8afff8c7c4 Preliminary Theme Support 2014-04-10 08:10:12 -04:00
spf13
c0a046cbfb Added internal rss.xml template and config option to turn off rss creation 2014-04-09 17:45:34 -04:00
spf13
93bcddebb3 Renamed Indexes to Taxonomies. Old template and config parameters still work. 2014-04-09 17:15:04 -04:00
spf13
af1acfbce7 writing indexes under more configuration conditions 2014-04-07 23:29:35 -04:00
spf13
9a83f7a01b Fixing all tests to pass with new Viper Config 2014-04-07 11:44:51 -04:00
spf13
62dd1d45c1 Hugo config abstracted into a general purpose config library called "Viper".
Hugo casting now in own library called "cast"
2014-04-05 01:40:33 -04:00
spf13
e50b9d8ac1 Adding support for logging & verbose logging. Consolidation of error handling. Integration of jWalterWeatherman library. Fixed #137 2014-03-31 13:23:34 -04:00
Mike Keesey
2540d884d8 Fixing issues go vet reports. 2014-03-01 09:56:17 -05:00
mattn
8ebb85f1f7 Fix build 2014-02-18 18:40:55 -05:00
spf13
75c260fa1c Only change rLimit on OSX (where it is needed). Fixed #194 2014-02-06 00:12:05 -05:00
spf13
3e87d7a86e Automatically increase the process ulimit to maximum available. fixes #168. 2014-02-01 12:51:11 -05:00
Egon Elbre
8d80f9b39e Added batching behavior for page building.
Quite often file watcher gets many changes and each change triggered a
build. One build per second should be sufficient. Also added tracking for
new folders.
2013-12-28 13:46:52 -05:00
Egon Elbre
e46148f948 Fix static file change detection on Windows.
Fixed windows uses different filepath separator. The filepath.ToSlash
shouldn't be used, because it can cause errors in filepath suffix and prefix
testing since "c:\a" isn't a prefix of "c:/a/b/c".
2013-12-28 13:45:38 -05:00
Caleb Spare
6da23f7449 Gofmt
Command: `gofmt -l -s -w .`
2013-12-16 17:40:10 -05:00
Michael D. Johas Teener
50d9046b64 remove initialization loop error from compile
copied HugoCmd to a local var, initialize that variable in the init
func, and then use the local var in the InitializeConfig func.
2013-11-12 17:36:23 -06:00
spf13
6017599a3c restored behavior of respecting config values unless set by command flags. fixed #116 2013-11-12 09:38:43 -05:00
spf13
23a711a29a Hugo updated to work with latest cobra 2013-11-01 18:43:41 -04:00
Noah Campbell
789aa6ad76 Removing check for directory: static, layouts
Removed these checks so a single file in content can generate a site.

For example, given a site with a content directory and an index.html,
running hugo -s dir will generate a project without any more input.
2013-10-31 16:06:24 -07:00
spf13
b580a25d1f Better error handling when rendering error found when in watch mode
In watch mode it should continue to watch for changes, in any other mode it should exit with a -1 error code so can check for success when scripting
2013-10-25 18:03:14 -04:00
spf13
cd71eb7389 Watching doesn't built site 2x on write (ignores rename events). Also ignores temporary files written by editors. 2013-10-24 16:45:24 -07:00
spf13
f5fda80486 simplified buildSite & better error handling around it 2013-10-09 19:14:26 -04:00
spf13
0318f7c149 Clean up server & build site logic. Fixed #94 2013-10-09 18:53:46 -04:00
spf13
dcfcbac589 Enabling Nitro ('--stepAnalysis') again. Fix #58 2013-10-03 09:44:45 -04:00
spf13
48e1068e3e fixed #85 2013-09-30 22:40:15 -04:00
spf13
3ae8dda203 Restoring build and watch functionality 2013-09-30 22:38:32 -04:00
spf13
94d7fe52f8 Change the interface to use commands and flags instead of just flags.
Better organization of main (controller style) code.
2013-09-29 02:10:29 -04:00