hugo-book icon indicating copy to clipboard operation
hugo-book copied to clipboard

add outdatedInfoWarning

Open ikingye opened this issue 3 years ago • 5 comments

Like this: image

  # Display a message at the beginning of an article to warn the readers that it's content may be outdated.
  # 在文章开头显示提示信息,提醒读者文章内容可能过时。
  [params.outdatedInfoWarning]
    enable = false
    hint = 30               # Display hint if the last modified time is more than these days ago.    # 如果文章最后更新于这天数之前,显示提醒
    warn = 180              # Display warning if the last modified time is more than these days ago.    # 如果文章最后更新于这天数之前,显示警告

https://github.com/olOwOlo/hugo-theme-even/blob/564697987de962672112b910422682eb6f9c26ba/exampleSite/config.toml

ikingye avatar Dec 22 '21 09:12 ikingye

Hi! You can try to add layouts/partials/docs/inject/content-before.html template to add it to your pages. not sure if it worth to add to default tempaltes.

alex-shpak avatar Dec 23 '21 15:12 alex-shpak

How can I use hints in content-before.html ? @alex-shpak

Neither of these works.

{{<hint info>}}
outdatedInfoWarning hints
{{</hint>}}
<blockquote class="book-hint info">
hint info 
</blockquote>

ikingye avatar Jan 15 '22 14:01 ikingye

Hm, I would expect later example to work, I can check.

alex-shpak avatar Feb 14 '22 14:02 alex-shpak

You need to wrap blockquote into markdown class

<div class="markdown">
  <blockquote class="book-hint info">
    hint info 
  </blockquote>
</div>

alex-shpak avatar Feb 18 '22 17:02 alex-shpak

@alex-shpak This works fine, thank you.

You need to wrap blockquote into markdown class

<div class="markdown">
  <blockquote class="book-hint info">
    hint info 
  </blockquote>
</div>

How can I get the Article-Update-Time from layouts/partials/docs/inject/content-before.html using JavaScript more easily?

ikingye avatar Feb 23 '22 08:02 ikingye