summaryrefslogtreecommitdiffstats
path: root/hugolib/permalinks_test.go
AgeCommit message (Collapse)Author
2019-03-23Make Page an interfaceBjørn Erik Pedersen
The main motivation of this commit is to add a `page.Page` interface to replace the very file-oriented `hugolib.Page` struct. This is all a preparation step for issue #5074, "pages from other data sources". But this also fixes a set of annoying limitations, especially related to custom output formats, and shortcodes. Most notable changes: * The inner content of shortcodes using the `{{%` as the outer-most delimiter will now be sent to the content renderer, e.g. Blackfriday. This means that any markdown will partake in the global ToC and footnote context etc. * The Custom Output formats are now "fully virtualized". This removes many of the current limitations. * The taxonomy list type now has a reference to the `Page` object. This improves the taxonomy template `.Title` situation and make common template constructs much simpler. See #5074 Fixes #5763 Fixes #5758 Fixes #5090 Fixes #5204 Fixes #4695 Fixes #5607 Fixes #5707 Fixes #5719 Fixes #3113 Fixes #5706 Fixes #5767 Fixes #5723 Fixes #5769 Fixes #5770 Fixes #5771 Fixes #5759 Fixes #5776 Fixes #5777 Fixes #5778
2018-12-30hugolib: Restore 0.48 slash handling in taxonomiesBjørn Erik Pedersen
Fixes #5571
2018-10-22hugolib: Integrate new page parserBjørn Erik Pedersen
See #5324
2018-10-03hugolib: Normalize permalink path segmentsCameron Moore
When constructing permalinks, ensure that most inputs used as path segments are normalized with PathSpec.MakeSegment instead of PathSpec.URLize. The primary exception to that rule is with taxonomy titles in pageToPermalinkTitle(). The approach taken here is to use URLize for taxonomy pages. Everything else will use MakeSegment. The reason for this exception is that people use taxonomies such as "s1/p1" to generate URLs precisely they way they wish (see #5223). Tests have been added to check for this case. Fixes #4926
2018-09-18Revert "hugolib: Normalize permalink path segments"Bjørn Erik Pedersen
This reverts commit 06976ebb8778e08fea89dbd9fcb875f6c8d650d4. Fixes #5223
2018-09-14hugolib: Normalize permalink path segmentsCameron Moore
When constructing permalinks, ensure that path segments are normalized with PathSpec.MakeSegment instead of PathSpec.URLize. Fixes #4926
2017-02-17all: Refactor to nonglobal Viper, i18n etc.Bjørn Erik Pedersen
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-01-07all: Refactor to non-global loggerBjørn Erik Pedersen
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
2016-10-24Avoid reading from Viper for path and URL funcsBjørn Erik Pedersen
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-03-25hugolib: Some more unexportsBjørn Erik Pedersen
2016-03-24hugolib: Even more Golint fixesBjørn Erik Pedersen
2015-12-10Add copyright header to that source files that don’t have one.Anthony Fok
See #1646
2014-11-02Change permalink validation and substitution.Austin Ziegler
2014-05-01permitting empty files again. Fixing some tests to now pass.spf13
2014-04-26Fix permalinks to subdomainstummychow
If you don't have access to the root domain of your site (eg a GitHub project page) and you try to generate custom permalinks, they must begin with a slash. Go's URL resolution library sees the leading slash and thinks "this URL starts at the root", just like a filesystem - so it discards your subdomain and maps all custom permalinks from the root of your site. Fine if you control the root domain, not so useful if you don't. Removing the check for a leading slash fixes this problem. You can now specify custom permalinks that do not start with a slash, and they will map safely regardless of what subdomain you upload the generated site under. Tests have been updated for this commit so that they continue to function.
2013-11-18configurable permalinks supportPhil Pennock
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>