diff options
author | Koichi MATSUMOTO <mzch@me.com> | 2019-09-15 19:31:37 +0300 |
---|---|---|
committer | Nate <nathancday@gmail.com> | 2019-09-15 19:31:37 +0300 |
commit | 95193b129ed16c431bc3405ea82b69fcee4d04b0 (patch) | |
tree | e0820273589bbea345278c4fa3d5b7bea2128a40 | |
parent | 3f78e92279041806ab1c9aa66735377f00ffd7e4 (diff) |
Fix warnings on the latest Hugo (#8)
* fix warnings by replacing deprecated link variables with .RelPermaLink
* add support for Talk/Coral with templates
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | layouts/_default/single.html | 8 | ||||
-rw-r--r-- | layouts/partials/coral.html | 25 | ||||
-rw-r--r-- | layouts/partials/header.html | 11 | ||||
-rw-r--r-- | layouts/partials/talk.html | 9 |
5 files changed, 56 insertions, 7 deletions
@@ -118,11 +118,19 @@ The current set up has two TwitterCard/OpenGraph options depending on the params The summary description will use the one provided in a post's front matter if it exists or use the generic site description from `config.toml`. You should also adjust the `twitterAuthor` and `twitterSite` params in `config.toml` to point to your account. You can check how your cards are rendering once your website is being publish with the [TwitterCard Validator](https://cards-dev.twitter.com/validator). - ### Font Awesome Font Awesome v5 icons are supported. The syntax for using these icons has changed with the version update. You must now include the full name of the icon e.g. `far fa-twitter` which adds a tag that specifies the weight of the icon used. Note that only free icons are supported by default. If you are a Font Awesome Pro user, you can add your website as a new project which will generate the code necessary to reference the pro CDN. Use the HTML code that is generated to replace that in the file at layouts/partials/css.html. Learn more in the [Font Awesome docs](https://fontawesome.com/how-to-use/on-the-web/referencing-icons/basic-use). +### [Coral](https://github.com/coralproject/talk) (formarly Talk) + +If you use [Coral](https://github.com/coralproject/talk) instead of Disqus, please follow the step. + +1. Delete or Comment out `disqusShortName` in `config.toml` +1. If you use Talk v4, add Talk Host in [params] section, i.e. `talkHost = "talk.example.com"` +1. If you use Coral (Talk v5), add Coral Host in [params] section, i.e. `coralHost = "coral.example.com"` + +**Attention** Talk/Coral Host has to support SSL encryption (in other word, URL starts https://...). ## Going forward diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 7a6ba5f..1367c9d 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -25,6 +25,14 @@ {{ end }} + {{ if .Site.Params.talkHost }} + {{ partial "talk.html" . }} + {{ end }} + + {{ if .Site.Params.coralHost }} + {{ partial "coral.html" . }} + {{ end }} + </main> {{ partial "footer.html" . }} diff --git a/layouts/partials/coral.html b/layouts/partials/coral.html new file mode 100644 index 0000000..21b551b --- /dev/null +++ b/layouts/partials/coral.html @@ -0,0 +1,25 @@ + <h4 class="page-header">Comments</h4> + <div id="coral_thread"></div> + <script type="text/javascript"> + (function() { + var d = document, s = d.createElement('script'); + s.src = 'https://{{ .Site.Params.coralHost }}/assets/js/embed.js'; + s.onload = function() { + Coral.createStreamEmbed({ + id: "coral_thread", + autoRender: true, + rootURL: 'https://{{ .Site.Params.coralHost }}', + // Uncomment these lines and replace with the ID of the + // story's ID and URL from your CMS to provide the + // tightest integration. Refer to our documentation at + // https://docs.coralproject.net for all the configuration + // options. + // storyID: '${storyID}', + // storyURL: '${storyURL}', + }); + }; + (d.head || d.body).appendChild(s); + })(); + </script> + <noscript>Please enable JavaScript to view the comments powered by + <a href="https://coralproject.net/">Coral</>.</noscript> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 05892a3..450b50f 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -4,11 +4,10 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>{{ .Title }}</title> - {{ partial "css" . }} {{ partial "js" . }} {{ .Hugo.Generator }} - {{ if .RSSLink }} - <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> - <link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" /> - {{ end }} + <link rel="canonical" href="{{ .Permalink }}"> + {{ partial "css" . }} {{ partial "js" . }} {{ hugo.Generator }} + <link href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> + <link href="{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" /> {{ if .Site.GoogleAnalytics }} <!-- Global Site Tag (gtag.js) - Google Analytics --> @@ -33,7 +32,7 @@ <meta name="theme-color" content="#ffffff"> <!-- Twitter Cards - https://xvrdm.github.io/2017/10/23/socialize-your-blogdown/ --> - {{ if eq .URL "/" }} + {{ if eq .RelPermalink "/" }} <meta property="og:title" content="{{ .Site.Title }}"> <meta property="og:type" content="website"> <meta property="description" content="{{ .Site.Params.description }}"> diff --git a/layouts/partials/talk.html b/layouts/partials/talk.html new file mode 100644 index 0000000..54115c9 --- /dev/null +++ b/layouts/partials/talk.html @@ -0,0 +1,9 @@ + <h4 class="page-header">Comments</h4> + <div id="coral_talk_stream"></div> + <script src="https://{{ .Site.Params.talkHost }}/static/embed.js" async onload=" + Coral.Talk.render(document.getElementById('coral_talk_stream'), { + talk: 'https://{{ .Site.Params.talkHost }}/' + }); + "></script> + <noscript>Please enable JavaScript to view the comments powered by + <a href="https://coralproject.net/talk">Talk</>.</noscript> |