🎨 Modify some Hugo syntax & use CSS style replace HTML DOM style.

This commit is contained in:
凡梦星尘
2022-06-05 21:35:40 +08:00
parent 3b81f46c4e
commit 531e65da7f
10 changed files with 121 additions and 79 deletions

View File

@@ -16,23 +16,6 @@
{{- $sn = (sort .nav "weight") }}
{{- $fc = index $sn 0 }}
{{- $sc = index $sn 1 }}
<style type="text/css">
.first-comment {
color: {{ $fc.color }};
{{- if eq .active (lower $fc.name) }}
font-weight: bold;
{{- end }}
}
.comment-switch .move, .switch-btn {
background-color: {{- if eq .active (lower $fc.name) }}{{ $fc.color }}{{ else }} {{ $sc.color }}{{ end }};
}
.second-comment {
color: {{ $sc.color }};
{{- if eq .active (lower $sc.name) }}
font-weight: bold;
{{- end }}
}
</style>
<div class="comment-switch">
<span class="first-comment">{{ $fc.title }}</span>
<span class="switch-btn {{ if eq .active (lower $sc.name) }}move{{ end }}"></span>
@@ -44,7 +27,7 @@
{{ $cp := "_thirdparty/comment/%s.html" }}
{{- if $tc }}
{{- range $sn }}
<div style="display: {{ if eq $active (lower .name) }} block {{ else }} none {{ end }};">
<div>
{{- partial (printf $cp (lower .name)) $root }}
</div>
{{- end }}