summaryrefslogtreecommitdiffstats
path: root/hugolib/site_test.go
AgeCommit message (Collapse)Author
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-06-08hugolib: Enable nested sectionsBjørn Erik Pedersen
Fixes #465
2017-05-26hugolib: Fix ref/relref issue with duplicate base filenamesBjørn Erik Pedersen
This commit also makes that function 80x faster. Fixes #2507
2017-05-26hugolib: Support regular pages in .Site.GetPageBjørn Erik Pedersen
Fixes #2844
2017-05-23hugolib: Add BenchmarkGetPageBjørn Erik Pedersen
2017-04-27hugolib: Avoid index.md in /index/index.htmlBjørn Erik Pedersen
Hugo 0.20 broke some sites that grouped their blog post and images together in subfolders. This commit re-introduces that behaviour: * If the file base name resolves to the same as the base name for the output type (i.e. "index" for HTML), the user probably meant it, so we treat that as an `uglyURL`, i.e. `my-blog-post-1.md`=> `/my-blog-post-1/index.html` * The main use case for this is to group blog post and images together. * Note that for the top level folder there will be a potential name conflict with a `section` `index.html` (if enabled) * This issue will not be relevant for subfolders in sections * Hugo will soon add support for nested sections, but we will have to find a way to separate them from the rest (`/content/_mysubsection` maybe). Fixes #3396
2017-04-23hugolib: Fix handling of zero-length filesBjørn Erik Pedersen
This was a regression in Hugo 0.20. This commit makes sure that zeron-length files are not rendered to file. Fixes #3355
2017-04-07hugolib: Add .Site.Params.mainSectionsBjørn Erik Pedersen
Fixes #3206
2017-04-04hugolib: Add optional outputFormat to Ref/RelRefBjørn Erik Pedersen
Fixes #3224
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
Before this commit, Hugo used `html/template` for all Go templates. While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc. This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use. A couple of notes: * The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work. * Ambiguous types will fall back to HTML. * Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials. * Shortcode templates are, by definition, currently HTML templates only. Fixes #3221
2017-04-02Revert "tpl: Rework to handle both text and HTML templates"Bjørn Erik Pedersen
Will have to take another stab at this ... This reverts commit 5c5efa03d2512749950b0d05a7d4bde35ecbdc37. Closes #3260
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
Before this commit, Hugo used `html/template` for all Go templates. While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc. This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use. A couple of notes: * The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work. * Ambiguous types will fall back to HTML. * Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials. * Shortcode templates are, by definition, currently HTML templates only. Fixes #3221
2017-03-27Remove the now superflous defaultExtensionBjørn Erik Pedersen
And some other unsed fields and methods.
2017-03-27hugolib: Refactor/-work the permalink/target path logicBjørn Erik Pedersen
This is a pretty fundamental change in Hugo, but absolutely needed if we should have any hope of getting "multiple outputs" done. This commit's goal is to say: * Every file target path is created by `createTargetPath`, i.e. one function for all. * That function takes every page and site parameter into account, to avoid fragile string parsing to uglify etc. later on. * The path creation logic has full test coverage. * All permalinks, paginator URLs etc. are then built on top of that same logic. Fixes #1252 Fixes #2110 Closes #2374 Fixes #1885 Fixes #3102 Fixes #3179 Fixes #1641 Fixes #1989
2017-03-25hugolib: Correctly identify "my_index_page.md"Bjørn Erik Pedersen
The above example was earlier identified as a section page and not a regular page. Fixes #3234
2017-02-19hugolib: Fix .Site.LastChangeBjørn Erik Pedersen
This commit makes sure that the `.Site.LastChange` is fetched from the latest page modification date. Previously, this value was fetched from the last page in the default page sort, which may not be the last by date if weight is set. Fixes #2909 Closes #2910
2017-02-18hugolib: More test helper cleanupBjørn Erik Pedersen
2017-02-17hugolib: Test helper cleanupBjørn Erik Pedersen
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-02-15Use OS fs by defaultBjørn Erik Pedersen
Fixes #3032
2017-02-10hugolib: Fix error for non-renderable HTML content with shortcodesBjørn Erik Pedersen
This commit re-introduces template lookup order that was accidently removed as part of the template nonglobal refactoring. Fixes #3021
2017-02-04all: Refactor to nonglobal file systemsBjørn Erik Pedersen
Updates #2701 Fixes #2951
2017-01-10 all: Refactor to nonglobal template handlingBjørn Erik Pedersen
Updates #2701
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-11-22node to page: Remove NodeBjørn Erik Pedersen
And misc. TODO-fixes Updates #2297
2016-11-22node to page: Make Nodes into PagesBjørn Erik Pedersen
* `.Site.Pages` now contains all page types, including sections etc. * `.Data.Pages` will also contain "node type" pages where relevant. Updates #2297
2016-11-22node to page: Handle aliases, 404, robots.txt, sitemapBjørn Erik Pedersen
Updates #2297
2016-11-22node to page: Basic outlineBjørn Erik Pedersen
Updates #2297
2016-10-28Fix RSS Title regressionBjørn Erik Pedersen
And add tests to make sure it doesn't happen again. Fixes #2645
2016-10-25Add missing template error loggingBjørn Erik Pedersen
2016-10-24Remove now superfluous lowercasingBjørn Erik Pedersen
See #2615 See #1129
2016-10-24all: Unify case of config variable namesAlbert Nigmatzianov
All config variables starts with low-case and uses camelCase. If there is abbreviation at the beginning of the name, the whole abbreviation will be written in low-case. If there is abbreviation at the end of the name, the whole abbreviation will be written in upper-case. For example, rssURI.
2016-10-16Fix case issue Viper vs Blackfriday configBjørn Erik Pedersen
There are still work to be done in the case department, but that will have to be another day. Fixes #2581 See https://github.com/spf13/viper/issues/261
2016-09-14Lazy calculate WordCount, ReadingTime and FuzzyWordCountBjørn Erik Pedersen
This avoids having to execute these expensive operations for sites not using these values. This commit sums up a set of wordcounting and autosummary related performance improvements. The effect of these kind of depends on what features your site use, but a benchmark from 4 Hugo sites in the wild shows promise: ``` benchmark old ns/op new ns/op delta BenchmarkHugo-4 21293005843 20032857342 -5.92% benchmark old allocs new allocs delta BenchmarkHugo-4 65290922 65186032 -0.16% benchmark old bytes new bytes delta BenchmarkHugo-4 9771213416 9681866464 -0.91% ``` Closes #2378
2016-09-06Render main content language in root by defaultBjørn Erik Pedersen
Fixes #2312
2016-09-06Multilingual TODO-fixes, take 1Bjørn Erik Pedersen
See #2309
2016-09-06Improve language handling in URLsBjørn Erik Pedersen
The current "rendering language" is needed outside of Site. This commit moves the Language type to the helpers package, and then used to get correct correct language configuration in the markdownify template func. This commit also adds two new template funcs: relLangURL and absLangURL. See #2309
2016-09-06Render the shortcodes as late as possibleBjørn Erik Pedersen
This is needed to make shortcode users happy with the new multilanguage support, but it will also solve many other related posts about "stuff not available in the shortcode". We will have to revisit this re the handler chain at some point, but that will be easier now as the integration test story has improved so much. As part of this commit, the site-building tests in page_test.go is refreshed, they now tests for all the rendering engines (when available), and all of them now uses the same code-path as used in production. Fixes #1229 Fixes #2323 Fixes ##1076
2016-09-06Optimize the multilanguage build processBjørn Erik Pedersen
Work In Progress! This commit makes a rework of the build and rebuild process to better suit a multi-site setup. This also includes a complete overhaul of the site tests. Previous these were a messy mix that were testing just small parts of the build chain, some of it testing code-paths not even used in "real life". Now all tests that depends on a built site follows the same and real production code path. See #2309 Closes #2211 Closes #477 Closes #1744
2016-09-06Add Translations and AllTranslations to NodeBjørn Erik Pedersen
This commit also consolidates URLs on Node vs Page, so now .Permalink should be interoperable. Note that this implementations should be fairly short-livded, waiting for #2297, but the API should be stable.
2016-09-06Introduce HugoSites typeBjørn Erik Pedersen
And a Hugo global variable which contains the site under build. This is really needed to get some level of control of the "multiple languages" in play. There are still work related to this scattered around, but that will come. With this commit, the multilingual feature is starting to work.
2016-09-06Add Translations and AllTranslations methods to PageBjørn Erik Pedersen
Will revisit Node later.
2016-09-06Add proper Language and Languages typesBjørn Erik Pedersen
2016-09-06Add multilingual support in HugoAlexandre Bourget
Implements: * support to render: * content/post/whatever.en.md to /en/2015/12/22/whatever/index.html * content/post/whatever.fr.md to /fr/2015/12/22/whatever/index.html * gets enabled when `Multilingual:` is specified in config. * support having language switchers in templates, that know where the translated page is (with .Page.Translations) (when you're on /en/about/, you can have a "Francais" link pointing to /fr/a-propos/) * all translations are in the `.Page.Translations` map, including the current one. * easily tweak themes to support Multilingual mode * renders in a single swift, no need for two config files. Adds a couple of variables useful for multilingual sites Adds documentation (content/multilingual.md) Added language prefixing for all URL generation/permalinking see in the code base. Implements i18n. Leverages the great github.com/nicksnyder/go-i18n lib.. thanks Nick. * Adds "i18n" and "T" template functions..
2016-08-19hugolib: Use named keys in composite literalsCameron Moore
Make `go vet` great again
2016-06-14hugolib: Support an expiration dateHanchen Wang
2016-04-17Add some schemaless BaseURL testsBjørn Erik Pedersen
See #2085
2016-04-12Fix broken testsBjørn Erik Pedersen
2016-04-12Revert "Use Node.ID for anchor ID"Bjørn Erik Pedersen
This reverts commit cd558958a0c0ecd06f7560a38e27334fe983e0de.
2016-04-11Use Node.ID for anchor IDBjørn Erik Pedersen
Fixes #2057