summaryrefslogtreecommitdiffstats
path: root/hugolib
AgeCommit message (Collapse)Author
2018-04-07Fix handling of --contentDir etc. flagBjørn Erik Pedersen
We need to revisit the commands package re globals and tests, but this should fix the init order of flags and languages. Fixes #4589
2018-04-07Revert "Disable failing test on Travis"Anthony Fok
This reverts commit 2170943ae6e4bcbbcb9cfad244fec5da8c1d6462 and commit 623c9afa8409855ccfd7b000ae7c6780b780a5af.
2018-04-06 And now really disable failing test on TravisBjørn Erik Pedersen
See #4584
2018-04-06Disable failing test on TravisBjørn Erik Pedersen
See #4584
2018-04-06hugolib: Set .Parent in bundled pages to its ownerBjørn Erik Pedersen
Fixes #4582
2018-04-05Fix livereload for the home page bundleBjørn Erik Pedersen
Fixes #4576
2018-04-05Fix some livereload content regressionsBjørn Erik Pedersen
Introduced in Hugo 0.38. Fixes #4566
2018-04-05Fix two tests that are broken on WindowsBrian Fitzgerald
Put guards around TestPageBundlerCaptureSymlinks and TestPageBundlerSiteWitSymbolicLinksInContent so that they aren't run on Windows (they both use symbolic links and the Go library implementation requires administrator mode on Windows).
2018-04-02Add support for a content dir set per languageBjørn Erik Pedersen
A sample config: ```toml defaultContentLanguage = "en" defaultContentLanguageInSubdir = true [Languages] [Languages.en] weight = 10 title = "In English" languageName = "English" contentDir = "content/english" [Languages.nn] weight = 20 title = "På Norsk" languageName = "Norsk" contentDir = "content/norwegian" ``` The value of `contentDir` can be any valid path, even absolute path references. The only restriction is that the content dirs cannot overlap. The content files will be assigned a language by 1. The placement: `content/norwegian/post/my-post.md` will be read as Norwegian content. 2. The filename: `content/english/post/my-post.nn.md` will be read as Norwegian even if it lives in the English content folder. The content directories will be merged into a big virtual filesystem with one simple rule: The most specific language file will win. This means that if both `content/norwegian/post/my-post.md` and `content/english/post/my-post.nn.md` exists, they will be considered duplicates and the version inside `content/norwegian` will win. Note that translations will be automatically assigned by Hugo by the content file's relative placement, so `content/norwegian/post/my-post.md` will be a translation of `content/english/post/my-post.md`. If this does not work for you, you can connect the translations together by setting a `translationKey` in the content files' front matter. Fixes #4523 Fixes #4552 Fixes #4553
2018-03-30Add .Site.IsServerRicardo N Feliciano
Fixes #4478
2018-03-24hugolib: Fix freeze in invalid front matter error caseBjørn Erik Pedersen
Fixes #4526
2018-03-21Allow themes to define output formats, media types and paramsBjørn Erik Pedersen
This allows a `config.toml` (or `yaml`, ´yml`, or `json`) in the theme to set: 1) `params` (but cannot override params in project. Will also get its own "namespace", i.e. `{{ .Site.Params.mytheme.my_param }}` will be the same as `{{ .Site.Params.my_param }}` providing that the main project does not define a param with that key. 2) `menu` -- but cannot redefine/add menus in the project. Must create its own menus with its own identifiers. 3) `languages` -- only `params` and `menu`. Same rules as above. 4) **new** `outputFormats` 5) **new** `mediaTypes` This should help with the "theme portability" issue and people having to copy and paste lots of setting into their projects. Fixes #4490
2018-03-20hugolib: Add ConfigSourceDescriptorBjørn Erik Pedersen
To prepare for config in themes See #4490
2018-03-18Spring test cleaning, take 2Bjørn Erik Pedersen
2018-03-17hugolib: Test cleaning #1Bjørn Erik Pedersen
2018-03-17hugolib: Trim some now superflous testsBjørn Erik Pedersen
These were written as a development aid in some kind of structural change at some point. They served their purpose then, but these are tests covered elsewhere and is deleted to reduce maintainance. The reported test covrage is not reduced because of this.
2018-03-17hugolib: Add Reset method to delete key from Scratchcmal
2018-03-16Add a way to merge pages by languageBjørn Erik Pedersen
As an example: ```html {{ $pages := .Site.RegularPages | lang.Merge $frSite.RegularPages | lang.Merge $enSite.RegularPages }} ``` Will "fill in the gaps" in the current site with, from left to right, content from the French site, and lastly the English. Fixes #4463
2018-03-12hugolib: Remove superflous debug fileBjørn Erik Pedersen
2018-03-12hugolib: Simplify Prev/NextBjørn Erik Pedersen
2018-03-11hugolib: Adjust GitInfo author date testBjørn Erik Pedersen
Now that we have a commit to assert against. See #4495
2018-03-11Refactor the GitInfo into the date handlersBjørn Erik Pedersen
Fixes #4495
2018-03-11hugolib: Extract date and slug from filenameBjørn Erik Pedersen
This commit makes it possible to extract the date from the content filename. Also, the filenames in these cases will make for very poor permalinks, so we will also use the remaining part as the page `slug` if that value is not set in front matter. This should make it easier to move content from Jekyll to Hugo. To enable, put this in your `config.toml`: ```toml [frontmatter] date = [":filename", ":default"] ``` This commit is also a spring cleaning of how the different dates are configured in Hugo. Hugo will check for dates following the configuration from left to right, starting with `:filename` etc. So, if you want to use the `file modification time`, this can be a good configuration: ```toml [frontmatter] date = [ "date",":fileModTime", ":default"] lastmod = ["lastmod" ,":fileModTime", ":default"] ``` The current `:default` values for the different dates are ```toml [frontmatter] date = ["date","publishDate", "lastmod"] lastmod = ["lastmod", "date","publishDate"] publishDate = ["publishDate", "date"] expiryDate = ["expiryDate"] ``` The above will now be the same as: ```toml [frontmatter] date = [":default"] lastmod = [":default"] publishDate = [":default"] expiryDate = [":default"] ``` Note: * We have some built-in aliases to the above: lastmod => modified, publishDate => pubdate, published and expiryDate => unpublishdate. * If you want a new configuration for, say, `date`, you can provide only that line, and the rest will be preserved. * All the keywords to the right that does not start with a ":" maps to front matter parameters, and can be any date param (e.g. `myCustomDateParam`). * The keywords to the left are the **4 predefined dates in Hugo**, i.e. they are constant values. * The current "special date handlers" are `:fileModTime` and `:filename`. We will soon add `:git` to that list. Fixes #285 Closes #3310 Closes #3762 Closes #4340
2018-03-10Allow partial redefinition of the ouputs configBjørn Erik Pedersen
Fixes #4487
2018-03-01Remove defaultLayout configBjørn Erik Pedersen
Not in use.
2018-02-26hugolib: Fix paginator URL for sections with URL in front matterBjørn Erik Pedersen
Fixes #4415
2018-02-25hugolib: Avoid scanning entire site to find the homeBjørn Erik Pedersen
See #4447
2018-02-25Fix bug in Site.assembleSections methodVas Sudanagunta
Site.assembleSections logic assumes that the the home page would always be the first in the Site's list of pages. This is not in fact guaranteed to be true. When it is not, the method can fail to set the parent for some or all root-level pages. 
 Fixes #4447
2018-02-22hugolib: Continue GitInfo lookup on errorBjørn Erik Pedersen
The current logic stops looking after the first failure to connect a page with a Git commit. This implies a fatal error, but that may not be the case.
2018-02-22Make ge, le etc. work with the Hugo Version numberBjørn Erik Pedersen
This means that you can do something ala: ```html {{ if ge .Hugo.Version "0.36" }}Reasonable new Hugo version!{{ end }} ``` The intented use is feature toggling, but please note that it will take some time and Hugo versions until this can be trusted. It does not work in older Hugo versions. Fixes #4443
2018-02-21Run gofmt -s with Go 1.10Bjørn Erik Pedersen
See #4434
2018-02-21hugolib: Fix broken footnote testBjørn Erik Pedersen
See #4433
2018-02-13hugolib: Improve error message in .RenderBjørn Erik Pedersen
2018-02-12Add support for YAML array data filesVas Sudanagunta
* Unmarshaled YAML arrays indistinguishable from JSON arrays. * Fixes #3890
2018-02-12Account for array type data in data dir merge/override logicVas Sudanagunta
* Fixes #4366 * Error message to console for unsupported data types
2018-02-12hugolib: Refactor tests for JSON, YAML and TOML equivalency, add coverageVas Sudanagunta
The same code now cycles through equivalent JSON, YAML and TOML data sets, verifying output both proper and identical. Coverage increased by applying previous tests for one format to the others. More DRY. Added tests for numeric and bool value types.
2018-02-12hugolib: Re-enable YAML data tests disabled in f554503fVas Sudanagunta
Also gave basic tests for JSON, YAML and TOML identical inputs and expected outputs, a step toward JSON, YAML and TOML equivalency (see https://github.com/gohugoio/hugo/issues/4393#issuecomment-364437785).
2018-02-09Add "target" and "rel" parameters to figure shortcodeKaushal Modi
Also: - Remove unnecessary space from `figure` tag if no class is specified. - Update related tests. - Add test cases for the changes made to the figure shortcode. - Document the newly added target and rel parameters - Add more detail to the documentation of all figure shortcode parameters.
2018-02-09hugolib: Temp. disable some YAML data testsBjørn Erik Pedersen
They fail. We will have to think about this. See #4393
2018-02-05hugolib: Add additional test to TestTemplateLookupOrderCameron Moore
Add an additional test to "Variant 4, theme, use site base" to also test for the index.html base (from by testing of #3505). Also add a "name" field to the test cases to make it easier to know which test is failing versus just getting a slice index.
2018-02-05hugolib: Fix broken TestTemplateLookupOrderCameron Moore
It looks like we left some debugging code in place that caused all but one test case to run.
2018-02-02Fix JSON array-based data file handling regressionVas Sudanagunta
This bug was introduced in Hugo 0.35. Fixes #4361
2018-02-02Increase data directory test coverageVas Sudanagunta
* Adds retro-coverage for #4361 * Verifies open issues #4138, #3890, #4366, 4083 * Removes test reliance on the very code it is testing (hugo/parser package). Expected results are now all built manually / are more precise. Tests can run against different versions (no linkage errs)
2018-01-30Fix language params handlingBjørn Erik Pedersen
This fixes some issues with language params handling by separating params from configuration values per language. This means that you can now do this: ```toml [languages] [languages.en] languageName = "English" weight = 1 title = "My Cool Site" [languages.en.params] myParam = "Hi!" ``` This is not a breaking change, but the above is a less suprising way of configuring custom params. It also fixes some hard-to-debug corner-cases in multilingual sites. Fixes #4356 Fixes #4352
2018-01-30hugolib: Extract the Fast Render Mode logic into a methodBjørn Erik Pedersen
This also improves on the previous commit as it takes pages without content files into account. Closes #4339
2018-01-30hugolib: Handle newly created files in Fast Render ModeAlexey Grachov
Updates #4339
2018-01-29hugolib: Deprecate useModTimeAsFallbackBjørn Erik Pedersen
Fixes #4351
2018-01-28hugolib: Fix --uglyURLs from comand line regressionBjørn Erik Pedersen
This bug was introduced in Hugo 0.33. Fixes #4343
2018-01-27Fix handling of top-level page bundlesBjørn Erik Pedersen
Fixes #4332
2018-01-26Add a way to disable one or more languagesBjørn Erik Pedersen
This commit adds a new config setting: ```toml disableLanguages = ["fr"] ``` If this is a multilingual site: * No site for the French language will be created * French content pages will be ignored/not read * The French language configuration (menus etc.) will also be ignored This makes it possible to start translating new languages and turn it on when you're happy etc. Fixes #4297 Fixed #4329