hexo-theme-butterfly/layout/includes/head.pug
Jerry c118e1e16a 🐛 1.修復首頁文章日期顯示錯誤的bug
🐛 2.修復因註釋掉豆瓣設置導致報Cannot read property 'meta' of undefined的bug
💄 3.調整文章頁post-meta和主頁post-meta的間距
💄 4.文章頁,當設置只顯示一個日期時,增加文字顯示
2020-03-19 01:15:45 +08:00

101 lines
3.7 KiB
Plaintext

- var pageTitle = page.title || config.title || ''
- if (is_archive()) pageTitle = _p('page.archives')
- if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
- if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
- if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
- if (is_year()) pageTitle += ': ' + page.year
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
- pageTitle ? '' : pageTitle = config.title || ''
- var pageDescription = page.description || page.title || config.description
- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
- var pageCopyright = config.copyright || config.author
- var without_html = url.replace('index.html', '')
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")
!=favicon_tag(theme.favicon || config.favicon)
if theme.disable_baidu_transformation
meta(http-equiv="Cache-Control" content="no-transform")
meta(http-equiv="Cache-Control" content="no-siteapp")
if page.hide == true
meta(name="robots" content="noindex")
if theme.douban
if theme.douban.meta && (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict]))
meta(name="referrer" content="no-referrer")
//- 預解析
!=partial('includes/head/dns_prefetch', {}, {cache:theme.fragment_cache})
//- 網站驗證
!=partial('includes/head/site_verification', {}, {cache:theme.fragment_cache})
//- Open_Graph
include ./head/Open_Graph.pug
//- PWA
if (theme.pwa && theme.pwa.enable)
!=partial('includes/head/pwa', {}, {cache:theme.fragment_cache})
script(src=url_for(theme.CDN.js_cookies))
if theme.darkmode.enable
!=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache})
each item in theme.CDN_USE.css
link(rel='stylesheet', href=url_for(item))
if theme.fontawesome_v5 && theme.fontawesome_v5.enable
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5))
else
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v4))
if (theme.fancybox && theme.fancybox.enable)
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.canonical
link(rel="canonical" href=without_html)
if is_post()
if(page.prev)
link(rel="prev" title=page.prev.title href=url_for(page.prev.permalink) )
if(page.next)
link(rel="next" title=page.next.title href=url_for(page.next.permalink) )
if theme.algolia_search.enable
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.algolia_search_css))
script(src=url_for(theme.CDN.algolia_search) defer)
//- comment css
include ./head/comment.pug
//- google_adsense
!=partial('includes/head/google_adsense', {}, {cache:theme.fragment_cache})
//- analytics
!=partial('includes/head/analytics', {}, {cache:theme.fragment_cache})
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