summaryrefslogtreecommitdiffstats
path: root/helpers
AgeCommit message (Collapse)Author
2018-05-28Add a BlackFriday option for rel="nofollow" on external linksStefan Neuhaus
Add a configuration option "nofollowLinks". When set to "true" the "HTML_NOFOLLOW_LINKS" flag is being passed to Blackfriday. Thereby all *absolute* links will get a "nofollow" value for the "rel" attribute. Fixes #4722
2018-05-27releaser: Prepare repository for 0.42-DEVhugoreleaser
[ci skip]
2018-05-25releaser: Bump versions for release of 0.41hugoreleaser
[ci skip]
2018-05-23Fix some recently broken embedded templatesBjørn Erik Pedersen
And add tests for them. Fixes #4757
2018-04-30releaser: Prepare repository for 0.41-DEVhugoreleaser
[ci skip]
2018-04-30releaser: Bump versions for release of 0.40.2hugoreleaser
[ci skip]
2018-04-29Fix .WordCount, .FuzzyWordCount, .ReadingTime when summary marker is setBjørn Erik Pedersen
This bug was introduced in Hugo 0.40. It is when you use the `<!--more-->` summary marker. Note that this affects the word stats only. The related `PlainWords`, `Plain`, `Content` all return correct values. Fixes #4675 Fixes #4682
2018-04-25releaser: Prepare repository for 0.41-DEVhugoreleaser
[ci skip]
2018-04-25releaser: Bump versions for release of 0.40.1hugoreleaser
[ci skip]
2018-04-23releaser: Prepare repository for 0.41-DEVhugoreleaser
[ci skip]
2018-04-23releaser: Bump versions for release of 0.40hugoreleaser
[ci skip]
2018-04-21Make .Content (almost) always available in shortcodesBjørn Erik Pedersen
This resolves some surprising behaviour when reading other pages' content from shortcodes. Before this commit, that behaviour was undefined. Note that this has never been an issue from regular templates. It will still not be possible to get **the current shortcode's page's rendered content**. That would have impressed Einstein. The new and well defined rules are: * `.Page.Content` from a shortcode will be empty. The related `.Page.Truncated` `.Page.Summary`, `.Page.WordCount`, `.Page.ReadingTime`, `.Page.Plain` and `.Page.PlainWords` will also have empty values. * For _other pages_ (retrieved via `.Page.Site.GetPage`, `.Site.Pages` etc.) the `.Content` is there to use as you please as long as you don't have infinite content recursion in your shortcode/content setup. See below. * `.Page.TableOfContents` is good to go (but does not support shortcodes in headlines; this is unchanged) If you get into a situation of infinite recursion, the `.Content` will be empty. Run `hugo -v` for more information. Fixes #4632 Fixes #4653 Fixes #4655
2018-04-16releaser: Prepare repository for 0.40-DEVhugoreleaser
[ci skip]
2018-04-16releaser: Bump versions for release of 0.39hugoreleaser
[ci skip]
2018-04-09releaser: Prepare repository for 0.39-DEVhugoreleaser
[ci skip]
2018-04-09releaser: Bump versions for release of 0.38.2hugoreleaser
[ci skip]
2018-04-05releaser: Prepare repository for 0.39-DEVhugoreleaser
[ci skip]
2018-04-05releaser: Bump versions for release of 0.38.1hugoreleaser
[ci skip]
2018-04-02releaser: Prepare repository for 0.39-DEVhugoreleaser
[ci skip]
2018-04-02releaser: Bump versions for release of 0.38hugoreleaser
[ci skip]
2018-04-02docs: Generate docshelper dataBjørn Erik Pedersen
And fix build ...
2018-04-02docshelper: List Chroma lexersBjørn Erik Pedersen
Fixes #4554
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-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-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-07releaser: Prepare repository for 0.38-DEVhugoreleaser
[ci skip]
2018-03-07releaser: Bump versions for release of 0.37.1hugoreleaser
[ci skip]
2018-02-27releaser: Prepare repository for 0.38-DEVhugoreleaser
[ci skip]
2018-02-27releaser: Bump versions for release of 0.37hugoreleaser
[ci skip]
2018-02-22Properly handle -DEV suffix when comparing Hugo versionsBjørn Erik Pedersen
See #4443
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-10tpl/transform: Add template func for TOML/JSON/YAML docs examples conversionBjørn Erik Pedersen
Usage: ```html {{ "title = \"Hello World\"" | transform.Remarshal "json" | safeHTML }} ``` Fixes #4389
2018-02-05releaser: Prepare repository for 0.37-DEVhugoreleaser
[ci skip]
2018-02-05releaser: Bump versions for release of 0.36hugoreleaser
[ci skip]
2018-01-31releaser: Prepare repository for 0.36-DEVhugoreleaser
[ci skip]
2018-01-31releaser: Bump versions for release of 0.35hugoreleaser
[ci skip]
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-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
2018-01-23helpers: Avoid unescape in highlightBjørn Erik Pedersen
Fixes #4219
2018-01-22releaser: Prepare repository for 0.35-DEVhugoreleaser
[ci skip]
2018-01-22releaser: Bump versions for release of 0.34hugoreleaser
[ci skip]
2018-01-18releaser: Prepare repository for 0.34-DEVhugoreleaser
[ci skip]
2018-01-18releaser: Bump versions for release of 0.33hugoreleaser
[ci skip]
2018-01-11releaser: Prepare repository for 0.33-DEVhugoreleaser
[ci skip]
2018-01-11releaser: Bump versions for release of 0.32.4hugoreleaser
[ci skip]
2018-01-08releaser: Prepare repository for 0.33-DEVhugoreleaser
[ci skip]
2018-01-08releaser: Bump versions for release of 0.32.3hugoreleaser
[ci skip]
2018-01-06Fix multihost detection for sites without language definitionBjørn Erik Pedersen
Static content was wrongly put into the lang-code subfolder. Fixes #4221
2018-01-06Fix URLs for bundle resources in multihost modeBjørn Erik Pedersen
Fixes #4217