Commit graph

342 commits

Author SHA1 Message Date
spf13 4a2f16f91e refactor handlers to use types instead of structs. 2014-11-20 12:43:34 -05:00
spf13 73f203ad86 Move template library into it's own package (tpl). No longer dependent on hugolib. Can be used externally. 2014-11-20 12:36:57 -05:00
Kartik Singhal 596d679386 Various fixes in RSS feed generation
- Prevent `.xml` generation for root section
- Remove redundant check for DisableRSS
- Fix permalinks for rel="alternate"
- Rename generated xml file to <type>/index.xml
- Add required description element in default template
- Make default RSS template validate on w3c (timezone format is still an issue)

Conflicts:
	hugolib/site.go
2014-11-17 18:55:40 -05:00
Chase Adams b716dbec1d Fix template checking order in site.go
- Change order of HasPrefix to match correct order
- Remove theme concatenation to _internal in last loop of
  appendthemetemplates so it looks in the right place for internal
templates

Conflicts:
	hugolib/site.go
2014-11-17 18:42:36 -05:00
Austin Ziegler d467ec0aab Fix a bug with taxonomy rendering.
- In `layouts/_default/taxonomy.html`, the `.Data` result does not
  provide the same information that `layouts/_default/terms.html` does
  for being able to identify the plural value of the term.
- This change adds `.Data.Singular` and `.Data.Plural` to provide
  similar capabilities.
- This *may* be incompatible with templates that check for `{{ if ne
  $taxonomy "Pages" }}` if the `page.Params` has either the singular or
  plural values as keys.
2014-11-13 12:32:10 -05:00
spf13 8a5dd06ad0 Use page.Markup to determine which PageHandler to use if it's set. 2014-11-04 00:44:30 -05:00
spf13 7b960ac121 New targets & new renderers and write methods [WIP] 2014-11-04 00:39:37 -05:00
spf13 e02dc6742a Cleanup file conversion handling 2014-11-04 00:36:05 -05:00
Austin Ziegler 8cc7684a91 Change the type of .Site.Author from…
…`map[string]string` to `map[string]interface{}`.

This allows values other than `string` values to be saved to Author,
such as:

    ```toml
    # config.toml
    …
    [Author]
      name = "Austin Ziegler"
      social-site = [ "Facebook", "Twitter", "GitHub" ]
    ```

My specific use-case is that I’m trying to make something work similar
whether it’s specified in `.Params.Author` or in `.Site.Author` without
introducing `.Site.Params.Author`.
2014-11-02 00:45:33 -04:00
bep d013edb7f8 Implement HasMenuCurrent and IsMenuCurrent for Nodes
Prior to this commit, `HasMenuCurrent` and `IsMenuCurrent` on `Node` always returned false.

This made it hard (if possible at all) to mark the currently selected menu item/group for non-Page content (home page, category pages etc.), i.e. for menus defined in the site configuration.

This commit provides an implementation of these two methods.

Notable design choices:

* These menu items have a loose coupling to the the resources they navigate to; the `Url` is the best common identificator. To facilitate a consistent matching, and to get it in line with the menu items connected to `Page`, relative Urls (Urls starting with '/') for menu items in the site configuration are converted to permaLinks using the same rules used for others’.
* `IsMenuCurrent` only looks at the children of the current node; this is in line with the implementation on `Page`.
* Due to this loose coupling, `IsMenuCurrent` have to search downards in the tree to make sure that the node is inside the current menu. This could have been made simpler if it could answer `yes` to any match of any menu item matching the current resource.

This commit also adds a set of unit tests for the menu system.

Fixes #367
2014-11-01 22:34:49 -04:00
spf13 141f3e19e0 Migrating Hugo to Afero for filesystem calls. 2014-11-01 11:57:29 -04:00
spf13 dfb8482569 Handlers WIP - Convert now working 2014-10-20 20:15:33 -04:00
spf13 30d4a26ba0 Handlers WIP (builds) 2014-10-20 17:51:53 -04:00
spf13 93f3d604c6 Handlers WIP 2014-10-20 17:42:16 -04:00
spf13 8bd0ffba43 Initial Handler Architecture WIP 2014-10-17 16:57:48 -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
Joel Scoble f52e662890 Feed the titleized taxonomy key through string replace to replace '-' with ' ' for proper display of the taxonmy title 2014-10-07 17:01:39 -04:00
Nate Finch 3f59abe885 add some information to rendering errors so it's easier to tell what's failing. 2014-09-29 09:19:39 -04:00
Nate Finch b590de6917 limit the number of goroutines used in taxonomy rendering to gomaxprocs*4 2014-09-14 07:23:03 -04:00
Nate Finch 49045b1cbc limit the number of goroutines we use for page rendering to gomaxprocs*4 2014-09-14 07:01:40 -04:00
Nate Finch cf3e748bd9 remove unused field 2014-09-12 07:25:45 -04:00
Nate Finch a72ca38c07 make the value of the BuildDrafts flag available to templates.This can be useful for if you only want to show some specific information on your local machine and/or when showing drafts. 2014-09-11 17:24:10 -04:00
Nate Finch 2ca615c551 Add Node.Site.Pages to all nodes and ensure all pages from the site exist in the list before processing shortcodes.
Node.Site.Recent is not really just recent pages, but all pages, so I figured it was better to add a new parameter with a more informative name.

I also changed the code slightly so that all pages are added to the list of pages before we start rendering shortcodes... this way you can use a shortcode to refer to another page.  Previosuly, this had been broken, because the list ofg pages would not be fully populated while the shortcodes were being processed.  The code that does this is not reading from disk or doing any rendering, so it shouldn't take any more time to do.
2014-09-08 11:50:09 -04:00
spf13 4bb5e326db Taxonomies can now be provided as a single string value if there is only one in frontmatter (tag = "val" vs tag = ["val"]) 2014-09-05 09:29:01 -04:00
spf13 242d6b4e6b Adjusting the number of go routines to build the pages in to 4*GOMAXPROCS (from 2) for faster rendering. 2014-08-30 01:15:20 -04:00
Nate Finch 47c91a4ca2 Fix CreatePages
This fixes #450.  There are two problems:

1.) We're creating a new goroutine for every page.
2.) We're calling s.Pages = append(s.Pages, page) inside each goroutine.

1 is a problem if in that if you have a ton of pages, that's a ton of goroutines.  It's not really useful to have more than a few goroutines at a time, and lots can actually make your code much slower, and, evidently, crash.

2 is a problem in that append is not thread safe. Sometimes it returns a new slice with a larger capacity, when the original slice isn't large enough.  This can cause problems if two goroutines do this at the same time.

The solution for 1 is to use a limited number of workers (I chose 2*GOMAXPROCS as a nice guess).
The solution for 2 is to serialize access to s.Pages, which I did by doing it in a single goroutine.
2014-08-30 01:02:35 -04:00
spf13 1b5f59b071 go fmt site.go 2014-08-25 13:13:11 -04:00
Chase Adams 348e123c9f Update 404 to be compiled to .html instead of directory 2014-08-25 09:38:08 -04:00
Joel Scoble c750a95e22 support for futre/draft summary info output 2014-08-20 14:21:15 -04:00
Billie H. Cleek aa42f4309c allow site to be built with empty content
Build the site even if there isn't anything in the content directory.
2014-06-30 15:28:18 -04:00
Nicholas Whittier 78962a14f8 Allows 404 templates from themes/THEME directories. 2014-06-30 15:22:52 -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 c502f078bc Add handling for publishDates (which will be ignored if in the future). Fixed #260 2014-05-29 00:48:40 -04:00
Rinat Abdullin 4ebaec8906 Include Section Taxonomy into SiteInfo
This allows to build more complex pages, like :
http://martinfowler.com/tags/
2014-05-28 19:31:50 -04:00
spf13 35a605976e SiteInfo is now a pointer on the Node 2014-05-28 19:11:54 -04:00
spf13 4076d77029 Simplifying the siteInfo handling 2014-05-28 18:37:59 -04:00
Phil Pennock 280df4e380 Fix Viperized .Site.Params
git bisect identified 62dd1d4 as the breaking commit; when
github.com/spf13/viper was introduced, the Params field was always
empty.

Given a map in YAML in Viper, the return type is
`map[interface{}]interface{}`, _not_ `map[string]interface{}`, even if
`.SetDefault()` has been called with an item of
`map[string]interface{}{}` so the cast assertion on the `.Get("Params")`
always failed.
2014-05-28 18:15:23 -04:00
spf13 be1ee22032 Proper integration of live reload with automatic injection 2014-05-16 17:49:27 -04:00
spf13 a4a1e39a51 Fixing issue when two menu items have the same name. 2014-05-14 18:08:11 -04:00
spf13 4f75ec985d Homepage renders with _default/list.html or then _default/single.html when index.html is not present. 2014-05-13 17:07:50 -04:00
Dato Simó 025a37df2f Fix permalink functionality, which was broken in 62dd1d4.
Viper stores Permalinks as a map[string]interface{}, so the type assertion
to PermalinkOverrides (map[string]PathPattern) will always fail.

We can, however, get Permalinks as a map[string]string, and convert each
value to a PathPattern.
2014-05-12 15:47:52 -04:00
Vincent Batoufflet 667a047cea Fix date issue with home page in Sitemap 2014-05-10 15:33:18 -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 1302ef9f63 Making site page initialization a bit more granular and accessible 2014-05-01 13:20:58 -04:00
spf13 bdf7cd9f9d Creating site menu configuration and have the docs site use it 2014-04-24 16:11:08 -06:00
spf13 4f813c09ea Fixing some bugs introduced in prior few commits. Tests now pass. 2014-04-24 10:18:47 -06:00
spf13 9ecf58e29b new menus system including active link & nesting 2014-04-23 02:59:19 -04:00
spf13 69c1944f1f Add handling of deeply nested front matter 2014-04-23 02:55:43 -04:00
spf13 4a8de8ea46 Add Disqus support out of the box. Move template/bundle into hugolib. 2014-04-23 02:53:12 -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 bb9bcdcf30 Add more information to the siteInfo (and configuration options) for better RSS generation. 2014-04-09 17:15:52 -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 ad34be9d77 strip trailing baseurl slash. Added a new template function "sanitizeurl" which ensures no double slashes. Fixed #221 2014-04-07 22:02:08 -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
spf13 6205a16b6e Fixes #227 by properly scoping the variables within the go routine. 2014-03-13 20:34:47 +01:00
spf13 3dfb475136 Parallelizing the largest build processes (templates, pages, indexes). Seeing 300%+ improvement of total build time. 2014-03-05 23:48:42 -05:00
spf13 14227351fa Reorganization of helpers. Centralized Url/Path logic. Fixed #175. 2014-02-27 20:33:18 -05:00
Tibor Vass 6dd2e9a49a gofmt all go code 2014-01-29 18:03:35 -05:00
spf13 d0825a211a Big refactor of pages code. Changed TOC code to only parse when actually used 2014-01-27 17:20:20 -05:00
spf13 f0634ec059 fixed #171. RSSlink is now RSSLink (and matches existing docs).
Added backwards compatibility accessor for existing templates.
2014-01-18 22:16:19 -05:00
spf13 44186c6af1 Extending rss item limit to 50… can reduce further in template with ‘first N’ functionality. 2014-01-18 21:18:54 -05:00
spf13 cb04053385 RSS improvements, now limit to 15 items and provide accurate date. fixed #172 2014-01-18 11:05:50 -05:00
Phil Pennock 438c219892 Add canonifyurls config option.
Be able to inhibit AbsURL canonicalization of content, on a site
configuration basis. Advantages of being able to inhibit this include
making it easier to rendering on other hostnames, and being able to
include resources on http or https depending on how this page was
retrieved, avoiding mixed-mode client complaints without adding latency
for plain http.
2014-01-13 10:06:12 -05:00
spf13 70745e8cb5 Complete refactor of indexes, move (and rewrite) page sorting to page.go, add tests 2013-12-20 09:10:05 -05:00
Caleb Spare 6da23f7449 Gofmt
Command: `gofmt -l -s -w .`
2013-12-16 17:40:10 -05:00
spf13 0e04b9a029 Moving processing short codes to the page 2013-12-06 23:57:24 -05:00
spf13 f432b187a0 render shortcodes prior to converting to html 2013-12-06 23:32:00 -05:00
spf13 44d57fdc0c Reorganize helpers 2013-12-05 09:29:41 -05:00
Phil Pennock 07978e4a49 configurable permalinks support
A sample config.yaml for a site might contain:

```yaml
permalinks:
  post: /:year/:month/:title/
```

Then, any article in the `post` section, will have the canonical URL
formed via the permalink specification given.

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-11-18 13:32:56 -08:00
spf13 ad2c0b5616 Homepage now has all content available, use sorting and first to control rendering 2013-11-14 09:37:58 -05:00
Phil Pennock 40d05f12a7 Truncated; .Site.Params; First function
* Add `.Truncated` bool to each page; will be set true if the
  `.Summary` is truncated and it's worth showing a "more" link of some
  kind.
* Add `Params` to the site config, defining `.Site.Params` accessible
  to each page; this lets the site maintainer associate arbitrary data
  with names, on a site-wide basis.
* Provide a `First` function to templates:
  * Use-case: `{{range First 5 .Site.Recent}}` or anything else which
    is a simple iterable provided by hugolib
* Tests by me for `.Truncated` and `First`

Also @noahcampbell contributed towards this:

* Add UnitTest for `.Site.Params`:
> Digging into this test case a bit more, I'm realizing that we need
> to create a param test case to ensure that for each type we render
> (page, index, homepage, rss, etc.) that the proper fields are
> represented.  This will help us refactor without fear in the
> future.

Sample config.yaml:

```yaml
title: "Test site"
params:
  Subtitle: "More tests always good"
  AuthorName: "John Doe"
  SidebarRecentLimit: 5
```

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-11-12 22:49:54 +00:00
Noah Campbell 86233c00a0 Remove the hugo-nav function
Remove the hugo-nav since it relied on a slow library.  The current
build reimplements the absurl functionality based on string replace.
Discovered that my prior implementation missed the requirement for
making absolute paths (/path) absolute with the host, whereas a relative
path is left untouched.  Updated the test cases to support this if this
is reimplemented.
2013-11-05 22:28:06 +00:00
Noah Campbell 1cebce12ad Adding RSS test case.
Checks to make sure the xml document starts with <?xml.  Previously, the
html translate package would write additional details into the document
that caused it to fail.
2013-11-05 07:03:02 +00:00
spf13 1fbcaf9279 Buffers instead of pipes 2013-11-05 00:28:08 -05:00
Noah Campbell 9af47f07d3 Improve rendering time
50% speedup.  Fix #91

to run the benchmark:

		go test -test.run=NONE -bench=".*" -test.benchmem=true ./transform/ > new.txt

to compare the results:

		/usr/local/go/misc/benchcmp baseline.txt new.txt

Speedup and memory improvements

		benchmark             old ns/op    new ns/op    delta
		BenchmarkChain           101219        50453  -50.15%
		BenchmarkTransform        51625        45531  -11.80%

		benchmark            old allocs   new allocs    delta
		BenchmarkChain              222          103  -53.60%
		BenchmarkTransform          135          106  -21.48%

		benchmark             old bytes    new bytes    delta
		BenchmarkChain            23919        10998  -54.02%
		BenchmarkTransform        11858        10665  -10.06%
2013-11-01 09:59:57 -07: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 a7dae30a8f More work on indexes 2013-10-31 09:49:29 -04:00
spf13 d20b41a2cf Big index overhaul. Now supporting ordering tokens by count or alphabetically. Also made full indexes available to the Site variable. 2013-10-25 18:40:55 -04: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 a5606b06ca Adding support for ordering content in indexes by other than date (weighted indexes) 2013-10-24 15:24:47 -07:00
spf13 3558e3d6f0 Add support for weighted pages
Now pages can be sorted by other than date
2013-10-18 11:01:31 -04:00
spf13 90090175f8 Adding preliminary support for weighted indexes (for ordering by other than date) 2013-10-17 23:57:25 -04:00
spf13 e58d8fe791 fixed #95, fixed #93 2013-10-09 23:38:51 -04:00
Noah Campbell 4993152dda Permalink to include multiple directories levels 2013-10-08 18:44:15 +02:00
Noah Campbell 9500ec1b6b Refactor layout selection code
The render code path would use a fallback if there was an exception.
This change instead relies on explicit declaration of the layout to use
and includes a check to see if the layout indeed exists before
attempting to render it.
2013-10-08 18:44:15 +02:00
Noah Campbell 197aacb647 Add support for Relative Permalinks 2013-10-08 18:42:03 +02:00
Noah Campbell 06da609138 Refactor Permalink to private function
This will allow for reuse of this particular function.
2013-10-08 18:42:03 +02:00
Noah Campbell 6fa6f69a4a Change transformer order 2013-10-08 18:42:03 +02:00
Noah Campbell d712d6f331 Moving transformation on a per-page level 2013-10-08 18:42:03 +02:00
Noah Campbell 9032a228b0 Better handle missing layouts
Panic is too extreme.  Instead the library will write out a message in
verbose mode.
2013-10-08 18:42:02 +02:00
Noah Campbell 54a2790fce Use io.Pipe for chaning render tasks.
Also clean up logic for finding layouts.
2013-10-08 18:42:02 +02:00
Noah Campbell 19cb6c7819 Move writing next to rendering
All render(Thing) calls have a WritePublic call directly after it.  This
refactor creates one function that makes the specific call sequence.
2013-10-08 18:40:40 +02:00
Noah Campbell 2176d2c197 Reducing scope of RenderThing* 2013-10-08 18:37:50 +02:00
Noah Campbell 80009b427f Change the order of Apply to be more Unixy
Typically the destination is on the left and the src is on the right.
2013-10-08 18:37:50 +02:00
Noah Campbell f0211b84a1 Rename Transform to AbsURL 2013-10-08 18:37:49 +02:00
spf13 5e14af957a Proper handling of 404 page return value 2013-10-07 09:24:13 -04:00
spf13 7468292c4e Fixing bug where RSS for site was rendered in wrong location 2013-10-07 09:23:42 -04:00
spf13 d829e05036 Fixing bug where only the first index list was created. 2013-10-07 09:07:14 -04:00
spf13 2aaf92b515 Summary can now contain short codes when using <!--more--> to define end of summary. 2013-10-04 16:07:24 -04:00
spf13 dcfcbac589 Enabling Nitro ('--stepAnalysis') again. Fix #58 2013-10-03 09:44:45 -04:00
spf13 92cff05582 go fmt so code 2013-09-29 02:10:29 -04:00
spf13 ff2b98c9dd Better error message when no source content is found. 2013-09-29 02:10:29 -04:00
Noah Campbell db50154e75 Support index.html indexes in content directory
If a file named index.html exists in a directory, or root, it will be
rendered as if ugly urls are turned on.  This allows for top level
content to not need a supporting layout file and content in content.
This change should not affect anyone who is using the perscribed way.

I also cleaned up a bunch of one off functions in site.go.
2013-09-24 21:27:25 -07:00
Noah Campbell 4250bf8e30 Fixes #80 - Homepage now renders correctly
I mistakenly make RenderHomePage a NOP.  Bad programmer.
2013-09-24 14:41:21 -07:00
Noah Campbell bffe4baf42 Create a TargetPath() method that provides OutFile
Moved the generation of the target path to the page breaking all
dependecies on Site.
2013-09-20 17:24:25 -07:00
Noah Campbell 52e8c7a0ac Section is determined by the source, not the url
This change allows for top level html content to exists.
2013-09-20 17:03:43 -07:00
Noah Campbell 311e102223 Allow non-markdown content in content directory
Allow content that is not markdown and does not need to be rendered to
exists in the content directory.  Currently any valid html or xml
document can exist.  Templates are applied to these documents as well.
If you need to have content that doesn't have templates or AbsUrlify
like operations, then continue to put this content in static and it will
be copied over.
2013-09-18 14:21:27 -07:00
Noah Campbell d8e1834910 Fix parsing edge case of frontmatter
When the frontmatter contains a - (or other delimiter) close to the
closing frontmatter delimiter, frontmatter detection would fail.
2013-09-18 09:15:46 -07:00
Noah Campbell 6b0752e8c0 Move AbUrlify to post content transformation
Currently the a@href and script@src elements will have BaseUrl applied
to their elements prior to being written to disk.
2013-09-17 14:16:06 -07:00
Noah Campbell 172ff5ea7a Initialize HTMLRedirectAlias before ShowPlan()
Without it, no alias information is generated when running --check
2013-09-13 15:06:37 -07:00
Noah Campbell d45fb72f67 Add /index.html to unadorned alias paths
Bring code to be better in line with documentation.
2013-09-13 14:51:28 -07:00
Noah Campbell 803a0fce1e Remove RenderedContent from page.
The output is written directly to disk after being written.  Not
entirely sure why it was split into two steps.
2013-09-13 10:30:27 -07:00
Noah Campbell 2ebfb33fe0 Move alias logic to target module
I want to move all logic to writing aliases to target so I can pave the
way for writing aliases specific to other runtimes (like .htaccess for
apache or a script for updating AWS or symlinking on a filesystem).
2013-09-12 21:20:00 -07:00
Noah Campbell 2f10da1570 Move alias rendering to target 2013-09-12 16:18:30 -07:00
Noah Campbell 74b55fc7c8 Normalize paths within hugo
filepath was used inconsistently throughout the hugolib.  With the
introduction of source and target modules, all path are normalized to
"/".  This simplifies the processing of paths.  It does mean that
contributors need to be aware of using path/filepath in any module other
than source or target is not recommended.  The current exception is
hugolib/config.go
2013-09-12 10:48:59 -07:00
Noah Campbell 610c06e658 Introduce source.Filesystem
This provides an abstraction over how files are processed by Hugo.  This
allows for alternatives like CMS systems or Dropbox, etc.
2013-09-04 22:42:52 -07:00
Noah Campbell d4d9da9f3a Remove page module dependence on opening files
The site is responsible for reading files, page only operates on
buffers.
2013-09-04 19:36:06 -07:00
Noah Campbell cb00917af6 Expand the ShowPlan functionality 2013-09-03 20:52:50 -07:00
Noah Campbell 4004687fb2 Move to target.Filesystem
Moving the ugly urls logic to the target.  There is still UglyUrl logic
in page for the permlink but this is dealing with the generate of urls.
2013-09-03 20:01:55 -07:00
Noah Campbell 13d2c55206 Adding Planner 2013-09-03 20:00:21 -07:00
Noah Campbell 79d9f82e79 Code reorg, helpers.go has been decomposed.
It started with wanting to move templates in template bundles and the
rest followed.  I did my best to start grouping related functions
together, but there are some that I missed.  There is also the method
Urlize that seems to be a special function used in both worlds.  I'll
need to revisit this method.
2013-09-03 16:16:07 -07:00
Noah Campbell 3ecc698f5e Remove hugolib.HTML and hugolib.URL types
These types were not be rendered correctly by the html/template package.
Removing them gets the correct behavior.

Fixes #74
2013-09-03 12:43:56 -07:00
Fabrizio (Misto) Milo ba82a20321 Add support for amber files
If a layout file ends with .amber it will interpreted as a Amber file

Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-01 19:51:32 -07:00
Fabrizio (Misto) Milo ee5865f239 Abstract html/template dependency
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-01 19:51:27 -07:00
Fabrizio (Misto) Milo 0a9dc705f3 Use s everywhere for consistency
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-01 19:51:21 -07:00
Mark Sanborn 6c8e7edbb4 The <!--more--> (summary divider) now works even if it is on the same line as content
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-09-01 07:44:29 -07:00
Noah Campbell 4349216deb Small code cleanup 2013-08-31 20:00:57 -07:00
Noah Campbell 0fdea0c2c2 Return an error with WritePublic 2013-08-30 21:24:25 -07:00
Noah Campbell 097b782a80 Removing site.Directories.
Please revert if this is used somewhere.
2013-08-30 21:13:50 -07:00
Noah Campbell b14b61af37 Externalize the writing of content to a target
Introducing the target module in hugo.  This provides the simple
interface for writing content given a label (filename) and a io.Reader
containing the content to be written.

If site.Target is not set, it defaults back to the original behavior of
writing to file system.

In hugolib/site_url_test.go I have an InMemoryTarget for testing
purposes and use it to see if the final output of a render matches.
2013-08-30 20:45:42 -07:00
Noah Campbell c32f401b15 Revert "Return errors when rendering"
This reverts commit e66ba5d2a7.

Fixed #69
2013-08-30 20:08:13 -07:00
Noah Campbell a792ec09ce Cleanup formatting - go fmt ./...
Remember to run go fmt ./... before committing.  Looks sternly in mirror
2013-08-30 14:39:12 -07:00
Mark Sanborn 4ed43e8076 Fixed bug where Url specified in front matter as pretty url wouldnt render
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-08-30 14:39:11 -07:00
Ross Lawley 1bb00b8c19 Refactored added RenderThingOrDefault and tests
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>

Conflicts:
	hugolib/site.go
2013-08-27 12:40:53 -07:00
Hugo Duncan 1de1992664 Return any error reported by RenderHomePage
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-08-23 16:55:40 -07:00
Ross Lawley 7b1f0960e3 Add 404.html for gh-pages
Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-08-23 16:38:35 -07:00
Noah Campbell f28a8fa0c2 RenderThing test cases
Provide unit test support RenderThing.

One observation is that creating the site.Tmpl variable is a one time
event.  site.Tmpl doesn't like additional templates with the same name.
This means that updating a template while in --watch mode requires
throwing away the entire Site object and creating a new one.  Not that
this is a bad idea, but it is something I discovered while working on
these unit tests.
2013-08-23 16:21:28 -07:00
Noah Campbell 599e6672f7 Removing GetSection
Using GetXXX is not idiomatic to Go.  Also added a bunch of unit testing
around this method.
2013-08-23 14:14:54 -07:00
Noah Campbell ae7112977d Skip "dot" files in layout
As a vim user, .filename.swp files pop up.  This change prevents hugo
from reading those files.
2013-08-23 13:58:52 -07:00
Hugo Duncan 301d2bafcd Print error if index value in a page is wrong type
This was causing a panic with no information displayed about the
page causing the error.
2013-08-20 16:39:26 -04:00
Steve Francia e2744d403c Merge pull request #43 from hugoduncan/feature/allow-xhtml-aliases
Enable aliases from .xhtml paths
2013-08-17 21:04:14 -07:00
Steve Francia 2542836bbc Merge pull request #41 from rozza/skipStatic
Skip Static directory if its in your content directory
2013-08-17 20:59:07 -07:00
Noah Campbell c713beba4d Formatting cleanup 2013-08-17 23:52:16 -04:00
Noah Campbell ec821739bc Removing the use of slash
An oversight on my behalf.  The FromSlash method is used when writing
out the public file name.  There is one place where the slashes are
required which is setting the output file.  I replaced those instances
with filepath.Join which should do the right thing depending on the OS.
2013-08-17 23:46:57 -04:00
Noah Campbell 8eca8f8aa0 Detect missed index from front matter 2013-08-17 23:45:03 -04:00
Noah Campbell e66ba5d2a7 Return errors when rendering 2013-08-17 23:45:03 -04:00
Hugo Duncan 23a98ad05c Enable aliases from .xhtml paths
When redirecting an alias from a .xhtml path, served with default content type,
a redirect only works if the html element has a xmlns attribute.  This adds the
attribute when the alias path ends in .xhtml
2013-08-16 00:29:46 -04:00
Ross Lawley 0f143dcf14 Skip Static directory if its in your content directory
Allows organisation where all source files are in one directory:

```
`config.yaml`:

contentdir: "source"
staticdir: "source/static"
...

 .
	└── source
		├── post
		|	├── firstpost.md	// <- http://site.com/post/firstpost.html
		|	└── secondpost.md	// <- http://site.com/post/secondpost.html
		└── static
			└── css
				 └── site.css	// <- http://site.com/css/site.css
```
2013-08-15 20:05:46 +01:00
spf13 3c3fc45d3c Merge branch 'master' of github.com:spf13/hugo 2013-08-14 10:19:59 -04:00
spf13 480e01eb15 Further work on path/section stuff. Tests passing now. 2013-08-14 08:57:14 -04:00
Steve Francia 7a51a8a5a3 Merge pull request #38 from noahcampbell/workflow_dotfile
Workflow dotfile
2013-08-13 20:03:18 -07:00
spf13 b4bcc591e4 Now support for nested paths. Better section detection. 2013-08-13 19:39:24 -04:00
spf13 ec02fa4bdd Adding support for a default content type template
default template found at layouts/_default/single.html
2013-08-13 09:23:43 -04:00
spf13 8968524900 Adding support for recent content. 2013-08-13 08:43:42 -04:00
Noah Campbell 97eb9225a7 Ignore dotfiles in content directory
This supports my personal workflow of using vim which places a temporary file in the same directory as the file I'm editing.
2013-08-12 20:40:52 -07:00
elij 023567b05e fix bad tab/space due to paste 2013-08-12 19:01:23 -07:00
elij 2f9b582dbe fix wrong renderlist feed permalink
when not using ugly urls, the feed permalink does not end up in the
expected location, and instead always behaves as if using ugly urls.

this fixes that behavior and inserts the feed xml file into the
directory as index.xml.

fixes #32
2013-08-12 19:00:29 -07:00
Noah Campbell 8c03141307 Use / for template names regardless of platform.
The path seperator was causing templates to not be loaded on windows.
Now all template names use / internally.
2013-08-12 15:03:06 -07:00
VonC 17aafb39dd Avoid error if no content.
The homepage should still be generated.
This is useful especially in the beginning, where you start just with
the homepage.
2013-08-12 14:31:39 +02:00
spf13 0233708907 Started new release notes, added nitro step for aliases 2013-08-10 15:44:22 +01:00
spf13 ac26de205e Adding correct canonical link to alias pages 2013-08-10 15:41:10 +01:00
spf13 d5518c0966 Adding support for aliases (redirects) 2013-08-10 15:35:34 +01:00
spf13 733c0207cb Merge branch 'master' of github.com:spf13/hugo
Conflicts:
	hugolib/site.go
2013-08-10 02:07:35 +01:00
Noah Campbell 2bbecc7bc8 Better reporting when the template is missing. 2013-08-09 17:36:32 -07:00
Noah Campbell 309db474c7 Nitro timer is encapsulated.
Remove the need for NewSite by relying on appropriate defaults.  Renamed
site.c to site.Config to allow Sites to be created outside the package.
2013-08-09 17:36:32 -07:00
Noah Campbell 274d324c8b Introduce unit testing for page.go 2013-08-09 17:36:32 -07:00
Noah Campbell fa55cd9857 Remove unreachable code path. 2013-08-09 17:36:32 -07:00
Noah Campbell fc5e92cc24 Provide better error handling
Change the method signatures to follow the check ok pattern.
2013-08-09 17:36:31 -07:00
spf13 a870f4d955 Fixing missing trailing slash in baseUrl 2013-08-08 12:30:01 +01:00
Nick Sabine 780e2f311b Populated page Site metadata. Enables accessing Indexes from Page template. 2013-08-07 14:23:24 -04:00
spf13 783f0d6154 fixing badlink on homepage 2013-08-06 01:06:59 +02:00
spf13 6789b6c5ce removing erroneous debugging output 2013-08-06 01:05:50 +02:00
spf13 dff86cb22c Renaming indexes template to indexes.html 2013-08-03 03:29:24 -04:00
spf13 52c089ffbd Added support for indexes of indexes & ordered indexes 2013-08-03 03:09:28 -04:00
spf13 ddad1e04ac adding previous next capabilities 2013-08-02 16:30:26 -04:00
Noah Campbell 3e539c7126 Adding error message when no content pages exists. 2013-08-01 13:27:56 -07:00
spf13 7ab28c564f Adding support for destination dir, split out static 2013-07-26 18:06:13 -04:00
spf13 92c31bbe10 permalink now respects pretty urls 2013-07-26 09:56:00 -04:00
spf13 d5f5543061 create content at any level of nesting 2013-07-26 09:28:26 -04:00
spf13 e08d14ad49 fixing issue with some urls missing '/' 2013-07-26 09:27:22 -04:00
spf13 8fae5f0dd6 Default is now pretty urls (without .html)
Adding --uglyurls option to retain previous behavior
2013-07-19 00:10:42 -07:00
spf13 c24112ce86 Render shortcodes before index and section rss feeds 2013-07-11 23:26:03 -04:00
spf13 649560fca2 proper BaseUrl handling (if has trailing slash or not) 2013-07-11 22:55:07 -04:00
spf13 7a521ad1a1 Fixing some RSS issues 2013-07-11 22:31:58 -04:00
spf13 75a2e6d4e8 Now support for config files as yaml, json or toml 2013-07-11 22:04:57 -04:00
spf13 51e3098548 Writing relative links to absolute so they work in feeds 2013-07-10 00:14:02 -04:00
spf13 f875577197 rendering shortcodes earlier for better performance 2013-07-05 12:03:47 -04:00
spf13 6e16449e5f adding hugo 2013-07-04 11:32:55 -04:00