Commit graph

4325 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 80230f26a3
Add support for theme composition and inheritance
This commit adds support for theme composition and inheritance in Hugo.

With this, it helps thinking about a theme as a set of ordered components:

```toml
theme = ["my-shortcodes", "base-theme", "hyde"]
```

The theme definition example above in `config.toml` creates a theme with the 3 components with presedence from left to right.

So, Hugo will, for any given file, data entry etc., look first in the project, and then in `my-shortcode`, `base-theme` and lastly `hyde`.

Hugo uses two different algorithms to merge the filesystems, depending on the file type:

* For `i18n` and `data` files, Hugo merges deeply using the translation id and data key inside the files.
* For `static`, `layouts` (templates) and `archetypes` files, these are merged on file level. So the left-most file will be chosen.

The name used in the `theme` definition above must match a folder in `/your-site/themes`, e.g. `/your-site/themes/my-shortcodes`. There are  plans to improve on this and get a URL scheme so this can be resolved automatically.

Also note that a component that is part of a theme can have its own configuration file, e.g. `config.toml`. There are currently some restrictions to what a theme component can configure:

* `params` (global and per language)
* `menu` (global and per language)
* `outputformats` and `mediatypes`

The same rules apply here: The left-most param/menu etc. with the same ID will win. There are some hidden and experimental namespace support in the above, which we will work to improve in the future, but theme authors are encouraged to create their own namespaces to avoid naming conflicts.

A final note: Themes/components can also have a `theme` definition in their `config.toml` and similar, which is the "inheritance" part of this commit's title. This is currently not supported by the Hugo theme site. We will have to wait for some "auto dependency" feature to be implemented for that to happen, but this can be a powerful feature if you want to create your own theme-variant based on others.

Fixes #4460
Fixes #4450
2018-06-10 23:55:20 +02:00
Bjørn Erik Pedersen 6464981adb
hugolib: Make sure that .Site.Taxonomies is always set on rebuilds
Fixes #4838
2018-06-10 20:55:17 +02:00
Christian Oliff 2e6712e281 tpl: Always load GA script over HTTPS 2018-06-09 23:47:44 +02:00
Alexandros 65deb72dc4 tplimpl: Remove speakerdeck shortcode
Fixes #4830
2018-06-09 11:13:36 +02:00
Bjørn Erik Pedersen dc4226a8b2 hugolib: Reset Page's main output on server rebuilds
Not doing so prevents the paginators to be rebuilt on changes.

Fixes #4819
2018-06-05 10:45:24 +03:00
Bjørn Erik Pedersen bf5f10faa9 Reset the "distinct error logger" on rebuilds
Fixes #4818
2018-06-05 10:45:24 +03:00
David E. Wheeler 019bd5576b tpl/strings: strings.RuneCount 2018-06-04 20:47:03 +03:00
Anthony Fok c3115292a7 tpl: Prevent isBaseTemplate() from matching "baseof" in dir
Fixes #4809
2018-06-04 10:09:55 +03:00
Bjørn Erik Pedersen 0c6c98e401
tpl/strings: Remove overflow check in strings.Repeat
The test fails on 32 bit systems. Let it panic instead.
2018-06-03 23:23:48 +03:00
Bjørn Erik Pedersen 90c7749085
tpl/strings: Adjust the overflow validation in strings.Repeat
This now matches the validation in the stdlib, but we return an error instead.
2018-06-03 10:35:45 +03:00
David E. Wheeler 13435a6f60 tpl: Add strings.Repeat 2018-06-03 09:55:37 +03:00
Alex 07b96d16e8 Fixes #4798 2018-05-31 18:05:38 +02:00
Alex ceaff7cafc tpl: Remove frameborder attr YT iframe + CSS fixes 2018-05-30 14:06:32 +02:00
Alex b84389c5e0 Fix vimeo_simple thumb scaling 2018-05-30 11:30:28 +02:00
Alexandros 8de5324479 Add vimeo_simple
Fixes #4749
2018-05-30 00:48:36 +02:00
Stefan Neuhaus 20cbc2c785 Add a BlackFriday option for rel="noreferrer" on external links
Add a configuration option "noreferrerLinks". When set to "true" the "HTML_NOREFERRER_LINKS" flag is being passed to Blackfriday. Thereby all *absolute* links will get a "noreferrer" value for their "rel" attribute.

See #4722
2018-05-29 16:54:43 +02:00
Bjørn Erik Pedersen 2174525cec
hugolib: A little more on shortcode ordinal 2018-05-28 10:29:48 +02:00
Stefan Neuhaus 7a6192647a Add a BlackFriday option for rel="nofollow" on external links
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-28 01:21:36 +02:00
Alex d68367cbe7 fix typo instagram_simple 2018-05-27 11:06:40 +02:00
hugoreleaser 5241f0baee
releaser: Prepare repository for 0.42-DEV
[ci skip]
2018-05-27 10:30:06 +02:00
Bjørn Erik Pedersen b5b36e3200
dep: Update Chroma
And be explicit about the revision. Chroma seem to be a little bit lazy with tagging.

Fixes #4779
2018-05-26 15:26:49 +02:00
Vas Sudanagunta 4f0665f476 Enhance Page and Resource String() 2018-05-26 09:43:47 +02:00
Bjørn Erik Pedersen fc8c5ad824
Merge tag 'v0.41'
releaser: 0.41 [ci skip]
2018-05-25 19:07:52 +02:00
hugoreleaser 171caf28a9 releaser: Add release notes to /docs for release of 0.41
[ci skip]
2018-05-25 16:57:18 +00:00
hugoreleaser 0e77f5d4e7 releaser: Bump versions for release of 0.41
[ci skip]
2018-05-25 16:57:17 +00:00
Bjørn Erik Pedersen 9e7e322ded
Release 0.41 2018-05-25 18:46:45 +02:00
hugoreleaser 06827398f9 releaser: Add release notes draft for 0.41
Rename to *-ready.md to continue. [ci skip]
2018-05-25 16:01:30 +00:00
Bjørn Erik Pedersen cfc5096e83
releaser: Put release notes below /en
Fixes #4712
2018-05-25 17:53:03 +02:00
Bjørn Erik Pedersen ab02594e09
create: Provide the correct .Site object to archetype templates
Fixes #4732
2018-05-25 17:35:06 +02:00
Bjørn Erik Pedersen c71f201fd9
docs: Document the GDPR Privacy Config
See #4751
2018-05-25 17:25:33 +02:00
Bjørn Erik Pedersen 4ed1228d55
Fix GA anonymizeIp order 2018-05-25 16:05:45 +02:00
Bjørn Erik Pedersen a51945ea4b Add no-cookie variants of the Google Analytics templates
The current full set of options for GA is now:

```toml
[privacy]
[privacy.googleAnalytics]
disable = false
respectDoNotTrack = true
anonymizeIP = true
useSessionStorage = true
```

Fixes #4775
2018-05-25 15:56:10 +02:00
Bjørn Erik Pedersen 7b9dbef41a
Merge commit 'd2b1030060d3c91d5f9ffa3456418da16bd74f1d' 2018-05-25 15:05:23 +02:00
Bjørn Erik Pedersen d2b1030060 Squashed 'docs/' changes from e161ea09d..0fd7b4169
0fd7b4169 Fix typo: pygmentsUseClasses -> pygmentsUseClassic
9a3e1c19a Clarify that lower weight gets higher precedence
820d8b581 Clarify the true behavior of hrefTargetBlank #blackfriday
eb3aa5e46 Fix typo
9aedb9269 Add examples for removing default taxonomies
772a26f84 Fix source link on maintainance
975c215ae Minor edits.
2bdb1a150 Fix invalid iink
991d2e139 Fix misspelling
60af8dfb0 Update eSolia link
d7426b76e Release 0.40.3
4977bd9cf Merge branch 'release-0.40.3'
9946f7108 releaser: Prepare repository for 0.41-DEV
beef16b01 releaser: Add release notes to /docs for release of 0.40.3
80c51c55a releaser: Bump versions for release of 0.40.3
21e2934c5 rename `taxonomies.html` to `taxonomy.html`
34a02c289 Add release notes from Hugo 0.7 to 0.15 for completeness
b593f512e Update related.md
7c2bf528b Fix the "edit this page" link
e8fbc163e Add warning about cond
ae15a8831 Add link to Markdown Guide
e077dfd65 Added documentation for a new migration tool: BlogMl2Hugo
957bfb6a8 Add Talkayrd, a new commenting system, & fix txtpen link
86acea7f8 Tomango showcase
3c2fc32f1 Fix snap classic command in installing.md
9a76f1737 Merge commit '83bef6955e014d40c0f00db9cebe09113154e999'
a4b71fb84 Fix typo

git-subtree-dir: docs
git-subtree-split: 0fd7b416997bf76cd99e3ae2dfae406cb8b6724a
2018-05-25 15:04:07 +02:00
Bjørn Erik Pedersen 0bf0e1972d
tpl: Remove the shortcode assets for now
Not in use.
2018-05-25 14:34:40 +02:00
Bjørn Erik Pedersen 1f244b802e
tpl: Adjust instagram_simple margins 2018-05-25 12:38:25 +02:00
Bjørn Erik Pedersen 448081b840
Remove youtube_simple for now
We need to revisit and complete that.

See #4751
2018-05-25 11:16:23 +02:00
Bjørn Erik Pedersen 1f1d955b56
Add anonymizeIP to GA privacy config
See #4751
2018-05-25 10:53:39 +02:00
Bjørn Erik Pedersen ffcf26e68c
Fix broken test 2018-05-24 13:03:23 +02:00
Bjørn Erik Pedersen 9753cb59f1
Support DNT in Twitter shortcode for GDPR
Fixes #4765
2018-05-24 12:25:52 +02:00
Bjørn Erik Pedersen 3bfe8f4be6
tpl: Alias tweet shortode to twitter
See #4765
2018-05-24 11:40:47 +02:00
Bjørn Erik Pedersen 6aa2c38507
Regenerate embedded templates
See #4761
2018-05-23 21:25:04 +02:00
Alexandros 6d69dac9da Fix youtube_simple thumb scaling
Fixes #4761
2018-05-23 21:22:25 +02:00
Bjørn Erik Pedersen 9ad46a2035 Add instagram_simple shortcode
Fixes #4748
2018-05-23 16:52:08 +02:00
Bjørn Erik Pedersen 4256de3392
deps: Go fmt 2018-05-23 16:33:11 +02:00
Bjørn Erik Pedersen bed7a0faff
Remove the id from youtube_simple
For now, anyway.

See #4751
2018-05-23 10:24:01 +02:00
Bjørn Erik Pedersen 35ccf06dae
Fix some recently broken embedded templates
And add tests for them.

Fixes #4757
2018-05-23 10:03:11 +02:00
Bjørn Erik Pedersen 4ddcf52ccc Add an unified .Site.Config with a services section
Fixes #4751
2018-05-22 18:11:03 +02:00
Bjørn Erik Pedersen 353148c2bc Move the privacy config into a parent
See #4751
2018-05-22 18:11:03 +02:00
Lorenz Cuno Klopfenstein 568b4335c2 commands: Avoid ANSI character output on Windows
Fixes #4462
2018-05-22 17:15:19 +02:00