Commit graph

22 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
20c9b6ec81
resource: Add front matter metadata to Resource
This commit expands the Resource interface with 3 new methods:

* Name
* Title
* Params

All of these can be set in the Page front matter. `Name` will get its default value from the base filename, and is the value used in the ByPrefix and GetByPrefix lookup methods.

Fixes #4244
2018-01-17 16:22:33 +01:00
Bjørn Erik Pedersen
ebf677a583 hubolib: Embed Page in WeightedPage
People can still say `.Page`, but by embedding it `WeightedPages` can be used interchangeably with `Pages` in templates.

Fixes #3435
2017-05-09 23:58:25 +02:00
Bjørn Erik Pedersen
c71e1b106e all: Refactor to nonglobal file systems
Updates #2701
Fixes #2951
2017-02-04 11:37:25 +07:00
Bjørn Erik Pedersen
c8d3124dde node to page: Remove Node
And misc. TODO-fixes

Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen
a10b2cd372 Avoid reading from Viper for path and URL funcs
The gain, given the "real sites benchmark" below, is obvious:

```
benchmark           old ns/op       new ns/op       delta
BenchmarkHugo-4     14497594101     13084156335     -9.75%

benchmark           old allocs     new allocs     delta
BenchmarkHugo-4     57404335       48282002       -15.89%

benchmark           old bytes       new bytes      delta
BenchmarkHugo-4     9933505624      9721984424     -2.13%
```

Fixes #2495
2016-10-24 13:45:30 +02:00
Robert Basic
7d5c9fbf44 Make ByCount sort consistently
When two or more taxonomies have the same number of pages,
sort them by name to have consistent ByCount sorting of
taxonomies.

Fixes #1930
2016-04-02 22:59:10 +02:00
Bjørn Erik Pedersen
fa1a9653e5 hugolib: Taxonomy GoDoc cleanup 2016-03-24 16:01:25 +01:00
Bjørn Erik Pedersen
8aa90f2b7e Try both prepped and unprepped taxonomy keys
Fixes #1869
2016-03-03 22:01:09 +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
Steve Francia
f045d7a611 Change the license to Apache 2.0 2015-11-23 22:16:36 -05: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
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
David Calavera
d5c77bdf68 Allow to reverse taxonomy entries. 2015-05-12 18:26:40 +02: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
bep
e007c9b25d hugolib: apply some more Golint rules 2015-03-07 12:53:20 +01:00
spf13
b719ba7e2b Adding Prev/Next functionality to all lists of pages (sections, taxonomies, etc) 2014-11-27 23:15:25 -05:00
Nate Finch
7142374332 Sort by title if dates are the same 2014-09-11 17:23:01 -04:00
Nate Finch
0099b5a3cb Change all uses of sort.Sort to sort.Stable.Using sort.Stable ensures that even if the sort keys are the same, the order of the sort will not randomly change. Using the old sort.Sort, if you had pages with no date, the lists of those pages would randomly reorder every time you regenerate the list, causing spurious changes to the output. Now they'll always get ordered in the same way. 2014-09-09 09:22:16 -04:00
spf13
70dc370c08 Making the term "Term" more consistent with Taxonomy usage. 2014-08-29 23:44:39 -04:00
spf13
01caaeba7a Making the Pages Sorting methods available within a taxonomy term. 2014-08-29 23:43:38 -04:00
Joel Scoble
4c735a7878 preserve alias case while lowercasing taxonomy 2014-08-25 10:16:59 -04:00
spf13
93bcddebb3 Renamed Indexes to Taxonomies. Old template and config parameters still work. 2014-04-09 17:15:04 -04:00
Renamed from hugolib/index.go (Browse further)