mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 13:07:06 +08:00
style: 部分css調整和html優化 improvements: 刪除pwa中的theme-color配置,默認生成meta theme-color close #340 improvements: 優化最後更新時間顯示(1小時內顯示 剛剛,1小時到24小時 顯示 xx小時前,1天到365天 顯示 xx天前,365天后直接顯示日期)
93 lines
3.5 KiB
Plaintext
93 lines
3.5 KiB
Plaintext
- var pageTitle
|
|
- if (is_archive()) pageTitle = _p('page.archives')
|
|
- else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
|
|
- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
|
|
- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
|
|
- else if (is_year()) pageTitle += ': ' + page.year
|
|
- else if (is_current('/404.html', [strict])) pageTitle = _p('error404.error_title')
|
|
- else pageTitle = page.title || config.title || ''
|
|
|
|
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
|
|
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
|
|
|
|
- var pageDescription = page_description()
|
|
- var pageKeywords
|
|
- if (page.keywords) pageKeywords = Array.isArray(page.keywords) ? (page.keywords).join(',') : ([]).join(',') || page.keywords
|
|
- else if (page.tags && page.tags.length) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
|
|
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
|
|
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
|
|
- var pageCopyright = config.copyright || config.author
|
|
- var themeColor = theme.display_mode === 'dark' ? '#0d0d0d' : '#ffffff'
|
|
|
|
meta(charset='UTF-8')
|
|
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
|
meta(name="viewport" content="width=device-width,initial-scale=1")
|
|
title= tabTitle
|
|
meta(name="description" content!=pageDescription)
|
|
if pageKeywords
|
|
meta(name="keywords" content=pageKeywords)
|
|
meta(name="author" content=pageAuthor)
|
|
meta(name="copyright" content=pageCopyright)
|
|
meta(name ="format-detection" content="telephone=no")
|
|
meta(name="theme-color" content=themeColor)
|
|
|
|
if theme.disable_baidu_transformation
|
|
meta(http-equiv="Cache-Control" content="no-transform")
|
|
meta(http-equiv="Cache-Control" content="no-siteapp")
|
|
|
|
!=favicon_tag(theme.favicon || config.favicon)
|
|
link(rel="canonical" href=urlNoIndex())
|
|
|
|
//- 預解析
|
|
!=partial('includes/head/preconnect', {}, {cache:theme.fragment_cache})
|
|
|
|
//- 網站驗證
|
|
!=partial('includes/head/site_verification', {}, {cache:theme.fragment_cache})
|
|
|
|
//- Open_Graph
|
|
include ./head/Open_Graph.pug
|
|
|
|
if theme.facebook_comments.app_id
|
|
meta(property="fb:app_id" content=theme.facebook_comments.app_id )
|
|
if theme.facebook_comments.user_id
|
|
meta(property="fb:admins" content=theme.facebook_comments.user_id)
|
|
|
|
//- PWA
|
|
if (theme.pwa && theme.pwa.enable)
|
|
!=partial('includes/head/pwa', {}, {cache:theme.fragment_cache})
|
|
|
|
//- main css
|
|
link(rel='stylesheet', href=url_for(theme.CDN.main_css))
|
|
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome))
|
|
|
|
if theme.fancybox
|
|
link(rel='stylesheet', href=url_for(theme.CDN.fancybox_css))
|
|
|
|
if (theme.snackbar && theme.snackbar.enable)
|
|
link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css))
|
|
|
|
if theme.algolia_search.enable
|
|
link(rel='stylesheet' href=url_for(theme.CDN.algolia_search_css))
|
|
script(src=url_for(theme.CDN.algolia_search) defer)
|
|
|
|
//- google_adsense
|
|
!=partial('includes/head/google_adsense', {}, {cache:theme.fragment_cache})
|
|
|
|
//- analytics
|
|
!=partial('includes/head/analytics', {}, {cache:theme.fragment_cache})
|
|
|
|
//- font
|
|
if theme.blog_title_font.font_link
|
|
link(rel='stylesheet' href=url_for(theme.blog_title_font.font_link))
|
|
|
|
//- global config
|
|
!=partial('includes/head/config', {}, {cache:theme.fragment_cache})
|
|
|
|
include ./head/config_site.pug
|
|
include ./head/noscript.pug
|
|
|
|
!=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache})
|
|
|
|
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})
|
|
|