summaryrefslogtreecommitdiffstats
path: root/hugolib/page.go
AgeCommit message (Collapse)Author
2017-07-17hubolib: Add HasShortcodeBjørn Erik Pedersen
Fixes #3707
2017-07-04output: Support templates per site/languageBjørn Erik Pedersen
This applies to both regular templates and shortcodes. So, if the site language is French and the output format is AMP, this is the (start) of the lookup order for the home page: 1. index.fr.amp.html 2. index.amp.html 3. index.fr.html 4. index.html 5. ... Fixes #3360
2017-06-19hugolib: Fix error handling for JSON front matterBjørn Erik Pedersen
Fixes #3610
2017-06-13Run gofmt to get imports in line vs gohugoio/hugoBjørn Erik Pedersen
2017-06-13all: Update textual references in Go source to point to gohugoio/hugoBjørn Erik Pedersen
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-06-08hugolib: Unexport some internal methodsBjørn Erik Pedersen
2017-06-08hugolib, commands: Improve live-reload on directory structure changesBjørn Erik Pedersen
This issue is more visible now that we support nested sections. This commit makes operations like pasting new content folders or deleting content folders during server watch just work. Fixes #3570
2017-06-08hugolib: Enable nested sectionsBjørn Erik Pedersen
Fixes #465
2017-05-26hugolib: Refine allKindsInPagesBjørn Erik Pedersen
2017-05-26hugolib: Add a cache to GetPageBjørn Erik Pedersen
Looks to be slightly slower with the low number of section pages, but the 1000 regular pages seem to add value. ``` benchmark old ns/op new ns/op delta BenchmarkGetPage-4 97.7 145 +48.41% BenchmarkGetPageRegular-4 7933 161 -97.97% benchmark old allocs new allocs delta BenchmarkGetPage-4 0 0 +0.00% BenchmarkGetPageRegular-4 0 0 +0.00% benchmark old bytes new bytes delta BenchmarkGetPage-4 0 0 +0.00% BenchmarkGetPageRegular-4 0 0 +0.00% ```
2017-05-13hugolib: Handle shortcode per output formatBjørn Erik Pedersen
This commit allows shortcode per output format, a typical use case would be the special AMP media tags. Note that this will only re-render the "overridden" shortcodes and only in pages where these are used, so performance in the normal case should not suffer. Closes #3220
2017-05-13hugolib: Handle any errors in processShortcodesBjørn Erik Pedersen
2017-05-10hugolib: The deprecated Extension, Now and TargetPath will now ERRORBjørn Erik Pedersen
2017-05-01tpl/collections: Make it a package that stands on its ownBjørn Erik Pedersen
See #3042
2017-04-22hugolib: Prevent decoding pageParam in common casesAlbert Nigmatzianov
2017-04-08hugolib: Remove unused lineBjørn Erik Pedersen
2017-04-08hugolib: Delay deletion of Page.Now()Bjørn Erik Pedersen
Looking at the state of the themes, it will be too painful to log ERROR now.
2017-04-07hugolib: Update deprecation vs Hugo 0.20Bjørn Erik Pedersen
Fixes #3271
2017-04-04hugolib: Add optional outputFormat to Ref/RelRefBjørn Erik Pedersen
Fixes #3224
2017-04-04hugolib: Read media types and output formats from site configBjørn Erik Pedersen
Closes #3222 Closes #3223
2017-04-04output: Add output formats decoderBjørn Erik Pedersen
And clean up the output package.
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-27hugolib, output: Restrict Render to regular PagesBjørn Erik Pedersen
Using it for list pages doesn't work and has potential weird side-effects. The user probably meant to range over .Site.ReqularPages, and that is now marked clearly in the log.
2017-03-27hugolib: Wrap pageOutput create in sync.OnceBjørn Erik Pedersen
2017-03-27output: Rename HTMLType etc. to HTMLFormatBjørn Erik Pedersen
2017-03-27hugolib: More TODO fixesBjørn Erik Pedersen
2017-03-27hugolib, layout: Consolidate RSS template handlingBjørn Erik Pedersen
2017-03-27Remove the now superflous defaultExtensionBjørn Erik Pedersen
And some other unsed fields and methods.
2017-03-27hugolib, output: Fix RSSLink vs output formatsBjørn Erik Pedersen
And remove the now superflous setPageURLs method.
2017-03-27Add custom protocol support in PermalinkBjørn Erik Pedersen
2017-03-27hugolib: Read default output formats from site configBjørn Erik Pedersen
2017-03-27output: Rework the base template logicBjørn Erik Pedersen
Extract the logic to a testable function and add support for custom output types. Fixes #2995
2017-03-27hubolib: Pick layout per output formatBjørn Erik Pedersen
2017-03-27hugolib: Fix layout lookup order for Render funcBjørn Erik Pedersen
Will have to fix this in a better way later in relation to the non-renderable pages. But this commit brings the Hugo Benchmark down to "only slightly slower" than master. ``` benchmark old ns/op new ns/op delta BenchmarkHugo-4 10074504521 10071236251 -0.03% benchmark old allocs new allocs delta BenchmarkHugo-4 43623091 49271859 +12.95% benchmark old bytes new bytes delta BenchmarkHugo-4 9468322704 9725848376 +2.72% ``` Which is something we can work with.
2017-03-27output: Speed up layout calculationsBjørn Erik Pedersen
``` BenchmarkLayout-4 4883 497 -89.82% benchmark old allocs new allocs delta BenchmarkLayout-4 18 1 -94.44% benchmark old bytes new bytes delta BenchmarkLayout-4 1624 32 -98.03% ```
2017-03-27hugolib: Speed up URL handlingBjørn Erik Pedersen
2017-03-27Refactor layout resolve to a descriptor/adapter patternBjørn Erik Pedersen
2017-03-27Rename OutputType to OutputFormatBjørn Erik Pedersen
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-27Implement the first generic JSON output testcaseBjørn Erik Pedersen
2017-03-27hugolob: A first incorporation of output types in renderingBjørn Erik Pedersen
2017-03-27hugolib: Use the new layout logic in PageBjørn Erik Pedersen
2017-03-27output: Add output typeBjørn Erik Pedersen
2017-03-27Add MediaType and a crude implementationBjørn Erik Pedersen
See #2828
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-03-11hugolib: Fix reloading corner cases for shortcodesBjørn Erik Pedersen
This commit fixes two different, but related issues: 1) Live-reload when a new shortcode was defined in the content file before the shortcode itself was created. 2) Live-reload when a newly defined shortcode changed its "inner content" status. This commit also improves the shortcode related error messages to include the full path to the content file in question. Fixes #3156
2017-03-11parser: Refactor frontmatter parser and add testsCameron Moore
Lots of cleanups here: - Refactor InterfaceToConfig and InterfaceToFrontMatter to use io.Writer. - Simplify InterfaceToFrontMatter by wrapping InterfaceToConfig. - Export FrontmatterType since we return it in DetectFrontMatter. - Refactor removeTOMLIdentifier to avoid blindly replacing "+++". - Update HandleJSONMetaData to return an empty map on nil input. - Updates vendored goorgeous package and test for org-mode frontmatter. - Add tests and godoc comments. Coverage for parser package increased from 45.2% to 85.2%.