Finish creative commons sidebar code.

This commit is contained in:
凡梦星尘 2022-05-05 11:34:46 +08:00
parent e92752a993
commit 03631d47c9
5 changed files with 55 additions and 31 deletions

View File

@ -1,9 +1,8 @@
#-------------------------------------- #--------------------------------------
# Hugo engine internal settings # Hugo engine internal settings
#-------------------------------------- #--------------------------------------
baseurl: / baseURL: /
metadataformat: yaml
theme: hugo-theme-next theme: hugo-theme-next
#-------------------------------------- #--------------------------------------
@ -29,22 +28,22 @@ languages:
# User-define Settings # User-define Settings
# ------------------------------------- # -------------------------------------
params: params:
# ------------------------------------- # -------------------------------------
# Scheme Settings # Scheme Settings
# ------------------------------------- # -------------------------------------
# Schemes # Schemes
#scheme: Muse #scheme: Muse
#scheme: Mist #scheme: Mist
#scheme: Pisces #scheme: Pisces
scheme: Gemini scheme: Gemini
# Dark Mode # Dark Mode
darkmode: true darkmode: true
#-------------------------------------- #--------------------------------------
# Site Information Settings # Site Information Settings
# ------------------------------------- # -------------------------------------
author: NexT 主题 author: NexT 主题
subtitle: 为 Hugo 打造的主题 subtitle: 为 Hugo 打造的主题
description: 保持简单的易用性和强大的功能。 description: 保持简单的易用性和强大的功能。
@ -53,7 +52,21 @@ params:
icon: /imgs/icons/favicon.ico icon: /imgs/icons/favicon.ico
small: /imgs/icons/favicon-16x16-next.png small: /imgs/icons/favicon-16x16-next.png
medium: /imgs/icons/favicon-32x32-next.png medium: /imgs/icons/favicon-32x32-next.png
apple_touch_icon: /imgs/icons/apple-touch-icon-next.png appleTouchIcon: /imgs/icons/apple-touch-icon-next.png
# Creative Commons 4.0 International License.
# See: https://creativecommons.org/about/cclicenses/
creativeCommons:
# Available values: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | cc-zero
license: by-nc-nd
# Available values: big | small
size: big
sidebar: true
post: true
# You can set a language value if you prefer a translated version of CC license, e.g. deed.zh
# CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org
# No setting is required here and can be done by multilanguage
# language: deed.zh

View File

@ -1,6 +1,8 @@
{{ $langCode := replaceRE "-([a-z]+)" (upper (substr .Site.Language -3)) .Site.Language }}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="{{ $langCode }}">
{{ partial "partials/head.html" . }}
{{ partial "partials/head.html" (dict "Page" . "langCode" $langCode) }}
<body itemscope itemtype="http://schema.org/WebPage" {{/*class="use-motion"*/}}> <body itemscope itemtype="http://schema.org/WebPage" {{/*class="use-motion"*/}}>
<div class="headband"></div> <div class="headband"></div>

View File

@ -1,4 +1,5 @@
{{ define "main" }} {{ define "main" }}
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang=""> <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="">
<link itemprop="mainEntityOfPage" href="http://example.com/2022/05/02/hello-world2/"> <link itemprop="mainEntityOfPage" href="http://example.com/2022/05/02/hello-world2/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person"> <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">

View File

@ -1,3 +1,5 @@
{{ $Site := .Page.Site }}
{{ $Params := $Site.Params }}
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
@ -5,17 +7,17 @@
<meta property="og:type" content="website"> <meta property="og:type" content="website">
<meta property="og:title" content="Hugo"> <meta property="og:title" content="Hugo">
<meta property="og:url" content="http://example.com/index.html"> <meta property="og:url" content="{{ $Site.BaseURL }}">
<meta property="og:site_name" content="Hugo"> <meta property="og:site_name" content="Hugo">
<meta property="og:locale" content="{{ .Site.Language }}"> <meta property="og:locale" content="{{ .langCode }}">
<meta property="article:author" content="John Doe"> <meta property="article:author" content="{{ $Params.author }}">
<link rel="canonical" href="{{ .Site.BaseURL }}"> <link rel="canonical" href="{{ $Site.BaseURL }}">
<link rel="shortcut icon" type="image/x-icon" href="{{ .Site.Params.favicon.icon }}"> <link rel="shortcut icon" type="image/x-icon" href="{{ $Params.favicon.icon }}">
<link rel="icon" type="image/x-icon" href="{{ .Site.Params.favicon.icon }}"> <link rel="icon" type="image/x-icon" href="{{ $Params.favicon.icon }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ .Site.Params.favicon.small }}"> <link rel="icon" type="image/png" sizes="16x16" href="{{ $Params.favicon.small }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ .Site.Params.favicon.medium }}"> <link rel="icon" type="image/png" sizes="32x32" href="{{ $Params.favicon.medium }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ .Site.Params.favicon.apple_touch_icon }}"> <link rel="apple-touch-icon" sizes="180x180" href="{{ $Params.favicon.appleTouchIcon }}">
<link rel="stylesheet" href="/css/main.css"> <link rel="stylesheet" href="/css/main.css">
{{ $style := resources.Get "css/style.css" | resources.ExecuteAsTemplate "css/style.css" . -}} {{ $style := resources.Get "css/style.css" | resources.ExecuteAsTemplate "css/style.css" . -}}
@ -24,5 +26,5 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
<title>{{ .Site.Title }}</title> <title>{{ $Site.Title }}</title>
</head> </head>

View File

@ -55,12 +55,12 @@
<div class="site-state-item site-state-posts"> <div class="site-state-item site-state-posts">
<a href="/archives/"> <a href="/archives/">
<span class="site-state-item-count">2</span> <span class="site-state-item-count">2</span>
<span class="site-state-item-name">日志</span> <span class="site-state-item-name">{{ T "SitePostsTitle" }}</span>
</a> </a>
</div> </div>
<div class="site-state-item site-state-tags"> <div class="site-state-item site-state-tags">
<span class="site-state-item-count">3</span> <span class="site-state-item-count">3</span>
<span class="site-state-item-name">标签</span> <span class="site-state-item-name">{{ T "SiteTagsTitle" }}</span>
</div> </div>
</nav> </nav>
</div> </div>
@ -84,9 +84,15 @@
<a href="https://www.facebook.com/yourname" title="FB Page → https:&#x2F;&#x2F;www.facebook.com&#x2F;yourname" rel="noopener" target="_blank"><i class="fab fa-facebook fa-fw"></i>FB Page</a> <a href="https://www.facebook.com/yourname" title="FB Page → https:&#x2F;&#x2F;www.facebook.com&#x2F;yourname" rel="noopener" target="_blank"><i class="fab fa-facebook fa-fw"></i>FB Page</a>
</span> </span>
</div> </div>
{{ $cc := .Site.Params.creativeCommons }}
{{ if and $cc $cc.sidebar }}
<div class="cc-license site-overview-item animated" itemprop="license"> <div class="cc-license site-overview-item animated" itemprop="license">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="https://cdn.jsdelivr.net/npm/@creativecommons/vocabulary@2020.11.3/assets/license_badges/big/by_nc_sa.svg" alt="Creative Commons"></a> <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.{{ substr .Site.Language 0 2 }}" class="cc-opacity" rel="noopener" target="_blank" title="{{ T "CCLinkTitle" }}">
<img src="/imgs/cc/{{ $cc.size }}/{{ replace $cc.license "-" "_" }}.svg" alt="{{ T "CCLinkTitle" }}">
</a>
</div> </div>
{{ end }}
<div class="links-of-blogroll site-overview-item animated"> <div class="links-of-blogroll site-overview-item animated">
<div class="links-of-blogroll-title"><i class="fa fa-globe fa-fw"></i> <div class="links-of-blogroll-title"><i class="fa fa-globe fa-fw"></i>
Links Links