mirror of
https://github.com/flysnow-org/maupassant-hugo.git
synced 2026-08-24 07:18:55 +00:00
feat: 自动隐藏文章目录/站点副标题为空时隐藏竖线 (#144)
* format code, hide post-toc when it's empty * 当subtitle为空时去掉title后面的竖线
This commit is contained in:
@@ -8,8 +8,13 @@
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsHome -}}
|
||||
{{ if .Site.Params.subtitle -}}
|
||||
<title>{{ .Site.Title }} | {{ .Site.Params.subtitle}}</title>
|
||||
<meta property="og:title" content="{{ .Site.Title }} | {{ .Site.Params.subtitle}}">
|
||||
{{ else -}}
|
||||
<title>{{ .Site.Title }}</title>
|
||||
<meta property="og:title" content="{{ .Site.Title }}">
|
||||
{{ end -}}
|
||||
<meta property="og:type" content="website">
|
||||
<meta name="Keywords" content="{{.Site.Params.keywords}}">
|
||||
<meta name="description" content="{{ .Site.Params.description }}">
|
||||
@@ -53,4 +58,4 @@
|
||||
{{ range .Site.Params.customCSS }}
|
||||
<link rel="stylesheet" href='{{ "/css/" | relURL }}{{ . }}'>
|
||||
{{ end }}
|
||||
</head>
|
||||
</head>
|
||||
@@ -71,8 +71,8 @@
|
||||
var postToc = $(".post-toc");
|
||||
if (postToc.length) {
|
||||
var leftPos = $("#main").offset().left;
|
||||
if(leftPos<220){
|
||||
postToc.css({"width":leftPos-10,"margin-left":(0-leftPos)})
|
||||
if (leftPos < 220) {
|
||||
postToc.css({ "width": leftPos - 10, "margin-left": (0 - leftPos) })
|
||||
}
|
||||
|
||||
var t = postToc.offset().top - 20,
|
||||
@@ -91,6 +91,10 @@
|
||||
e < t ? postToc.css(a.start) : postToc.css(a.process)
|
||||
})
|
||||
}
|
||||
|
||||
if ($("#TableOfContents").children().length < 1) {
|
||||
$(".post-toc").remove();
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user