-
Notifications
You must be signed in to change notification settings - Fork 735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added out-of-date content warning #68
feat: added out-of-date content warning #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哇,谢谢 PR !
exampleSite/config.toml
Outdated
@@ -98,6 +98,15 @@ copyright = "" # default: author.name ↓ # 默认为下面配 | |||
gitmentCSS = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitment@0.0.3/style/default.min.css" crossorigin="anonymous">' | |||
gitalkJS = '<script src="https://cdn.jsdelivr.net/npm/gitalk@1.2.2/dist/gitalk.min.js" integrity="sha256-DcjhdbufsHMHflFjZtKNFnPKOAL2ybOxGcPOR4MtnJg=" crossorigin="anonymous"></script>' | |||
gitalkCSS = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1.2.2/dist/gitalk.css" integrity="sha256-rJVe5uyYRXdLM+Kkoj7JtN+9qI0bZTxkYTaNWODpg7U=" crossorigin="anonymous">' | |||
timeagoJS = '<script src="https://cdnjs.cloudflare.com/ajax/libs/timeago.js/3.0.2/timeago.min.js" integrity="sha256-jwCP0NAdCBloaIWTWHmW4i3snUNMHUNO+jr9rYd2iOI=" crossorigin="anonymous"></script>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 jsdelivr,这个包括了 cloudflare 的节点
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
怎么和本地版本不一样 ❓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cdn上只有3.0的版本,github上只放出最新版本,我搜搜历史记录里有没有旧版本留下
@@ -0,0 +1,28 @@ | |||
{{ if or .Params.enableOutdatedInfoWarning (and .Site.Params.outdatedInfoWarning.enable (ne .Params.enableOutdatedInfoWarning false)) }} | |||
{{ $daysAgo := div (sub now.Unix .Lastmod.Unix) 86400 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用一些 -
符号减少不必要的空行,例如 {{- ... }}
会消除之前所有的空格和空行
layouts/partials/scripts.html
Outdated
{{ if .Site.Params.fancybox }}<script type="text/javascript" src="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.js" | relURL }}"></script>{{ end }} | ||
{{- end -}} | ||
|
||
<!-- timeago.JS --> | ||
<script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
资源加载一起放在这一坨,需要加上判断条件,不启用的时候避免加载
layouts/partials/scripts.html
Outdated
{{ if .Site.Params.fancybox }}<script type="text/javascript" src="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.js" | relURL }}"></script>{{ end }} | ||
{{- end -}} | ||
|
||
<!-- timeago.JS --> | ||
<script> | ||
// NOTE: In order to display Chinese, Hugo site config "languageCode" must be "zh_CN" (case sensitive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以的话做一下转换
已经按要求改好
测试过开关这选项、开关public cdn 时的显示和资源加载,编码用zh-cn和en时的显示 |
非常感谢! |
我不是前端,避免大红配大绿是我审美的极限了,现在的2个颜色还是偷来的wwww 配色方面如果能给点建议就最好了,我不确定能刚好抄到那么多顺眼的颜色wwww |
并不懂配色~~ |
谢谢,这几天准备发版要狂加班,周日如果有空再看看。 |
嗯,我先合并这个了,如果你有空的话,可以之后再开一个 PR |
网上已经有足够多过时的技术文章,持续误导着后来的人,应该有个明显的标识提示文章更新于多久前,让读者注意。
实际效果见:http://keithmo.me/post/2016/07/19/first/
当前实现的缺点:
zh_CN
,hugo的languageCode
也必须这么写,不然时间默认英文。1年前
。另外我不懂法文和西班牙文,i18n里那2个文件更新的部分直接复制英文的……