Commit graph

213 commits

Author SHA1 Message Date
Mathias Biilmann 2989c38245 tpl: Add truncate template function
This commit adds a truncate template function for safely truncating text without
breaking words. The truncate function is HTML aware, so if the input text is a
template.HTML it will be truncated without leaving broken or unclosed HTML tags.

    {{ "this is a very long text" | truncate 10 " ..." }}
    {{ "With [Markdown](/markdown) inside." | markdownify | truncate 10 }}
2017-01-06 10:42:32 +01:00
Daniel Lang 2127203ae3 Update documentation and test for sitemap template 2017-01-03 17:11:22 +01:00
Nishanth Shanmugham cabc6b3186 tpl: Add now function
Add a now template function that returns the current time as time.Time.
Also, update related docs.
2017-01-01 02:50:46 +01:00
digitalcraftsman 707d3cf137 docs, tpl: Fix documentation of UniqueID
See #2861
2016-12-31 17:55:03 +01:00
Emily Huynh a4fc20a12b docs: Fix typo in templates/blocks
Fixed typo in templates/blocks.md in the docs.
2016-12-22 17:05:48 +01:00
Brian Shumate 6fd4bfcae3 docs: Update layouts path name 2016-12-16 01:09:51 +01:00
Bjørn Erik Pedersen 79b2725ac4 docs: Improve documentation for block templates
Hopefully.

Fixes #2363
2016-12-15 22:02:21 +01:00
Cameron Moore 596bbea815 docs: Clarify single page template search path
Fixes #2791
2016-12-15 19:34:25 +01:00
Cameron Moore 26084ad198 docs: Fix pipe examples
Fixes #2787
2016-12-15 19:33:40 +01:00
Cameron Moore fa09e20d9a docs: Fix Ref and RelRef syntax
Fixes #2793
2016-12-15 19:32:41 +01:00
Cameron Moore 2f0e81989a docs: Document partialCached func
Fixes #2779
2016-12-15 19:31:43 +01:00
Cameron Moore 9c2ea3691a docs: Add .Site.RegularPages docs
Fixes #2775
2016-12-15 11:15:42 +01:00
madhead e4ebe0d5bf docs: Fix querify example 2016-12-14 11:01:11 +01:00
Cameron Moore b4404a9554 docs: Update File variables 2016-12-10 10:47:23 +01:00
digitalcraftsman 2236056672 docs: Fix linebreaks in templates/variables.md 2016-12-04 18:21:52 +01:00
digitalcraftsman 0f6c73cf2e tpl: Add sha256 template function
Fixes #2742
2016-12-04 15:03:52 +01:00
digitalcraftsman 01b8bc1b26 docs: Update description of querify 2016-12-03 20:23:59 +01:00
digitalcraftsman 0ba9fb9631 docs: Document querify template func
Closes #2733
2016-12-03 20:12:12 +01:00
Bjørn Erik Pedersen a5b3b07657 docs: Add Pages to variables section
And some other minor doc fixes.

Closes #2297
Closes #2649
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen e29f6fe527 docs: Add sections on node now being a page
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen aafbd3b4bf docs: Revise docs to reflect that Node is gone
Updates #2297
2016-11-22 09:57:03 +01:00
Bjørn Erik Pedersen 65f803e1fa docs: Rename RSSlink to RSSLink
The former will be deprecated.
2016-11-19 12:00:25 +01:00
Tristan Rice a49f838cd0 tpl: Add imageConfig function
Add imageConfig function which calls image.DecodeConfig and returns the height, width and color mode of the image. (#2677)

This allows for more advanced image shortcodes and templates such as those required by AMP.

layouts/shortcodes/amp-img.html
```
{{ $src := .Get "src" }}
{{ $config := imageConfig (printf "/static/%s" $src) }}

<amp-img src="{{$src}}"
           height="{{$config.Height}}"
           width="{{$config.Width}}"
           layout="responsive">
</amp-img>
```
2016-11-16 13:00:45 +01:00
Albert Nigmatzianov f21e2f25c9 all: Unify case of config variable names
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-24 20:56:00 +02:00
Nate Finch 10a773cde7 Implement support for alias templates
This change adds a canonical alias.html template that is used for page
redirects, and passes the page as data to the template under .Page

Fixes #2533
Closes #2576
2016-10-15 15:25:05 +02:00
Bjørn Erik Pedersen 4a79fa0c33 Revert the "standardize author data"
There were some breaking changes etc. that is too late to fix for 0.17.

Let us think this through and add proper author support for Hugo 0.18.

Fixes #2464

Revert "docs: Add documentation for author profiles"

This reverts commit b6673e5309.

Revert "Add First Class Author Support"

This reverts commit cf978c0649.
2016-09-18 19:16:39 +02:00
digitalcraftsman b6673e5309 docs: Add documentation for author profiles 2016-09-17 13:14:05 +02:00
Derek Perkins cf978c0649 Add First Class Author Support
Closes #1850
2016-09-17 00:49:24 +02:00
digitalcraftsman 3410007dca docs: List multilingual tpl vars and show menu creation
Fixes #2436
2016-09-16 15:37:12 +02:00
Bjørn Erik Pedersen 2f7e8df5ba docs: Fix spelling: HasTranslations > IsTranslated 2016-09-06 18:32:20 +03:00
Bjørn Erik Pedersen 93717aac5c docs: Get the variable and funcs re multilingual up-to-date 2016-09-06 18:32:20 +03:00
Bjørn Erik Pedersen 54141f71dd Improve language handling in URLs
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-06 18:32:18 +03:00
Alexandre Bourget ec33732fbe Add multilingual support in Hugo
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-09-06 18:32:15 +03:00
vsopvsop 7cb8107735 docs: Correct spelling for "parameters" in partials.md 2016-08-29 12:25:53 +02:00
digitalcraftsman 38d034df38 docs: Document shuffle template func
Fixes #2393.
2016-08-29 12:22:37 +02:00
Eric 2fc05dad4e docs: Add location of block template 2016-08-20 21:54:14 +02:00
Wade Fitzpatrick b33bfd40be docs: Add doc for time template func 2016-08-08 12:28:41 +02:00
digitalcraftsman 04889a5ee6 docs: Document .File variables for pages
Fixes #2154.
2016-07-29 20:12:28 +02:00
Chris DeLuca 333646c52d docs: Drop .isDraft to new line
Bring **.isDraft** onto a new line, to be consistent with the other list items.
2016-07-29 20:10:40 +02:00
Cathal Garvey 20555b1630 Add htmlEscape and htmlUnescape template functions
These functions allow trivial escaping and unescaping of HTML entities,
and make it far easier to compose other functions for the creation of
parameterised URLs.
2016-07-19 00:14:05 +02:00
Michael Orr 0a812beb12 tpl: Modify tpl.humanize to ordinalize integer input
Add logic to tpl.humanize such that it understands input of int literals
or strings which represent an integer. When tpl.humanize sees this type
of input, it will use inflect.Ordinalize as opposed to the standard
inflect.Humanize.

Fixes #1886
2016-07-13 22:09:59 +02:00
marco c21e2b3b4d tpl: Enable safeHTMLAttr
See #2234 and #347
2016-06-27 09:18:14 -06:00
Hanchen Wang f7b2e532e2 docs: Add ExpiryDate to the list of variables 2016-06-14 15:45:26 +02:00
Hanchen Wang 448f0306d7 docs: Example of how to use Order by ExpiryDate 2016-06-14 15:45:26 +02:00
digitalcraftsman 20358f46c8 docs: Document UniqueID page variable 2016-05-27 20:14:52 +02:00
Roy Reveltas 5611631539 docs: Add an example of how to use .PrevInSection
It's not a common knowledge what the "pointer" is so let's
add an example of how to use .PrevInSection
2016-05-27 20:02:29 +02:00
digitalcraftsman ac938d9da7 docs: Improve description for .Hugo.Generator 2016-05-11 20:59:31 +02:00
Alex Leventer a07889d4a3 docs: Fix typo in templates/content.md 2016-05-04 21:40:22 +02:00
mattjmcnaughton bf4206a02f docs: Fix links in the documentation
A couple of internal links use `#toc_4` to attempt to locate a document
element within another document page. In both of these instances, there
is no element on the linked to pages with the id `#toc_4`. This commit
updates those links with the document elements which were the original
intended links, meaning these links now take you directly to the
intended element.

Signed-off-by: mattjmcnaughton <mattjmcnaughton@gmail.com>
2016-05-04 21:35:24 +02:00
Christopher Mancini 09038865c2 tpl: Add intersect operator to where function
Returns true if a given field value that is a slice / array of strings, integers or floats contains elements in common with the matching value. It follows the same rules as the intersect function.

Closes #1945
2016-04-28 00:58:47 +02:00