Skip to content

Commit

Permalink
fix: configure aff
Browse files Browse the repository at this point in the history
  • Loading branch information
lopins committed Nov 1, 2024
1 parent a9fa209 commit 2797481
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 51 deletions.
2 changes: 1 addition & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title = '装配师'
theme = 'huishou'

# 常规设置
defaultContentLanguageInSubdir = false # 在子目录中呈现默认内容语言,例如content/en/。然后站点根目录/将重定向到/en/。默认为false
# defaultContentLanguageInSubdir = false # 在子目录中呈现默认内容语言,例如content/en/。然后站点根目录/将重定向到/en/。默认为false
enableRobotsTXT = true
enableEmoji = true
languageCode = 'zh-cn' # en / zh-cn
Expand Down
34 changes: 14 additions & 20 deletions static/assets/js/common.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
// 百度商桥代码
var _hmt = _hmt || [];
(function(){
var _token = ["566b31777728579c3005d1e6318bdbae"];
var _stat = "https://hm.baidu.com/hm.js?";
_token.forEach(function(token) {
var script = document.createElement("script");
script.src = _stat + token;document.head.appendChild(script);
});
})();
// 客服链接
$(function() {
//点击按钮时判断 百度商桥代码中的“我要咨询”按钮的元素是否存在,存在的话就执行一次点击事件
$(".shangqiao").click(function(event) {
// 跳转到kefu页面
window.location.href = "/kefu.html";
// var api = $53.createApi();
// api.push('cmd', 'kfclient');
// api.push('type', 'popup');
// api.query();
});
});

Expand All @@ -27,26 +41,6 @@ document.addEventListener('DOMContentLoaded', function() {
});
});

/*
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?566b31777728579c3005d1e6318bdbae";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
$(function() {
//点击按钮时判断 百度商桥代码中的“我要咨询”按钮的元素是否存在,存在的话就执行一次点击事件
$(".shangqiao").click(function(event) {
var api = $53.createApi();
api.push('cmd', 'kfclient');
api.push('type', 'popup');
api.query();
});
});
*/

(function () {
$("img.lazyload").lazyload();
$('.zhiding').hide();//默认隐藏指定按钮
Expand Down
13 changes: 9 additions & 4 deletions themes/huishou/layouts/_default/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -2147,12 +2147,17 @@
{{ $firstPage := index (first 1 $pages) 0 }}
{{ if $firstPage }}
{{ $content := $firstPage.Content }}
{{ $matches := findRE `src="(https?://[^\"]+)"` $content -1 }}
{{ $matches := findRE `src="([^"]+)"` $content -1 }}
{{ $imageUrl := "https://cdn.jsdelivr.net/gh/lopinv/wooooden.com/static/assets/images/logo.png" }}
{{ if $matches }}
{{ $firstMatch := index $matches 0 }}
{{ $imageUrl = replaceRE `^src="` "" $firstMatch }}
{{ $imageUrl = replaceRE `"$` "" $imageUrl }}
{{ $firstMatch := index $matches 0 }}
{{ $extractedUrl := replaceRE `src="([^"]+)"` "${1}" $firstMatch }}
{{ if not (or (hasPrefix $extractedUrl "http://") (hasPrefix $extractedUrl "https://")) }}
{{ $baseUrl := .Site.BaseURL }}
{{ $imageUrl = printf "%s%s" $baseUrl $extractedUrl }}
{{ else }}
{{ $imageUrl = $extractedUrl }}
{{ end }}
{{ end }}
<a href="{{ $firstPage.Permalink }}" title="{{ $firstPage.Title }}" target="_blank">
<dl>
Expand Down
36 changes: 23 additions & 13 deletions themes/huishou/layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@
<div class="box-list">
<div class="box-tab">
<ul>
<a href="/news/list.html">
<a href="/news.html">
<li class="active">全部内容</li>
</a>
<a href="/news/list/type/3.html">
<a href="/news.html?type=3">
<li class="">企业动态</li>
</a>
<a href="/news/list/type/4.html">
<a href="/news.html?type=4">
<li class="">市场资讯</li>
</a>
<a href="/news/list/type/5.html">
<a href="/news.html?type=5">
<li class="">优惠活动</li>
</a>
<a href="/news/list/type/6.html">
<a href="/news.html?type=6">
<li class="">好货推荐</li>
</a>
<a href="/news/list/type/7.html">
<a href="/news.html?type=7">
<li class="">家具知识</li>
</a>
</ul>
Expand All @@ -66,16 +66,21 @@
<div class="box-content">
{{ range .Paginator.Pages }}
{{ $content := .Content }}
{{ $matches := findRE `src="(https?://[^\"]+)"` $content -1 }}
{{ $matches := findRE `src="([^"]+)"` $content -1 }}
{{ $imageUrl := "https://cdn.jsdelivr.net/gh/lopinv/wooooden.com/static/assets/images/logo.png" }}
{{ if $matches }}
{{ $firstMatch := index $matches 0 }}
{{ $imageUrl = replaceRE `^src="` "" $firstMatch }}
{{ $imageUrl = replaceRE `"$` "" $imageUrl }}
{{ $extractedUrl := replaceRE `src="([^"]+)"` "${1}" $firstMatch }}
{{ if not (or (hasPrefix $extractedUrl "http://") (hasPrefix $extractedUrl "https://")) }}
{{ $baseUrl := .Site.BaseURL }}
{{ $imageUrl = printf "%s%s" $baseUrl $extractedUrl }}
{{ else }}
{{ $imageUrl = $extractedUrl }}
{{ end }}
{{ end }}
<a href="{{ .Permalink }}" target="_blank" title="{{ .LinkTitle }}">
<dl>
<dt style="background-image: url('{{ $imageUrl }})">
<dt style="background-image: url('{{ $imageUrl }}')">
</dt>
<dd>
<p class="over1">{{ .LinkTitle }}</p>
Expand Down Expand Up @@ -119,12 +124,17 @@
{{ $page := index $pages $index }}

{{ $content := $page.Content }}
{{ $matches := findRE `src="(https?://[^\"]+)"` $content -1 }}
{{ $matches := findRE `src="([^"]+)"` $content -1 }}
{{ $imageUrl := "https://cdn.jsdelivr.net/gh/lopinv/wooooden.com/static/assets/images/logo.png" }}
{{ if $matches }}
{{ $firstMatch := index $matches 0 }}
{{ $imageUrl = replaceRE `^src="` "" $firstMatch }}
{{ $imageUrl = replaceRE `"$` "" $imageUrl }}
{{ $extractedUrl := replaceRE `src="([^"]+)"` "${1}" $firstMatch }}
{{ if not (or (hasPrefix $extractedUrl "http://") (hasPrefix $extractedUrl "https://")) }}
{{ $baseUrl := .Site.BaseURL }}
{{ $imageUrl = printf "%s%s" $baseUrl $extractedUrl }}
{{ else }}
{{ $imageUrl = $extractedUrl }}
{{ end }}
{{ end }}
<a href="{{ $page.Permalink }}" target="_blank" title="{{ $page.Title }}">
<dl>
Expand Down
24 changes: 17 additions & 7 deletions themes/huishou/layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
<meta name="keywords" content="{{- if .Keywords -}}{{ delimit .Keywords ", " }}{{ else }}{{ delimit .Params.tags ", " }}{{ end -}}" />
<meta name="description" content="{{ .Summary | plainify}}" />
{{ $content := .Content }}
{{ $matches := findRE `src="(https?://[^\"]+)"` $content -1 }}
{{ $matches := findRE `src="([^"]+)"` $content -1 }}
{{ $imageUrl := "https://cdn.jsdelivr.net/gh/lopinv/wooooden.com/static/assets/images/logo.png" }}
{{ if $matches }}
{{ $firstMatch := index $matches 0 }}
{{ $imageUrl = replaceRE `^src="` "" $firstMatch }}
{{ $imageUrl = replaceRE `"$` "" $imageUrl }}
{{ $extractedUrl := replaceRE `src="([^"]+)"` "${1}" $firstMatch }}
{{ if not (or (hasPrefix $extractedUrl "http://") (hasPrefix $extractedUrl "https://")) }}
{{ $baseUrl := .Site.BaseURL }}
{{ $imageUrl = printf "%s%s" $baseUrl $extractedUrl }}
{{ else }}
{{ $imageUrl = $extractedUrl }}
{{ end }}
{{ end }}
<meta property="og:locale" content="zh_CN" />
<meta property="og:type" content="article" />
Expand Down Expand Up @@ -151,7 +156,7 @@
},
"sameAs": [
"https://www.wooooden.com/",
"https://www.issem.cn/",
"https://www.issem.cn/"
],
"numberOfEmployees": 999,
"founder": {
Expand Down Expand Up @@ -268,12 +273,17 @@ <h1 class="info-title">{{ .Title }}</h1>
{{ with (where .Site.RegularPages "Params.hidden" "!=" true).Related $opts | first 5 }}
{{ range . }}
{{ $content := .Content }}
{{ $matches := findRE `src="(https?://[^\"]+)"` $content -1 }}
{{ $matches := findRE `src="([^"]+)"` $content -1 }}
{{ $imageUrl := "https://cdn.jsdelivr.net/gh/lopinv/wooooden.com/static/assets/images/logo.png" }}
{{ if $matches }}
{{ $firstMatch := index $matches 0 }}
{{ $imageUrl = replaceRE `^src="` "" $firstMatch }}
{{ $imageUrl = replaceRE `"$` "" $imageUrl }}
{{ $extractedUrl := replaceRE `src="([^"]+)"` "${1}" $firstMatch }}
{{ if not (or (hasPrefix $extractedUrl "http://") (hasPrefix $extractedUrl "https://")) }}
{{ $baseUrl := .Site.BaseURL }}
{{ $imageUrl = printf "%s%s" $baseUrl $extractedUrl }}
{{ else }}
{{ $imageUrl = $extractedUrl }}
{{ end }}
{{ end }}
<a href="{{ .Permalink }}" target="_blank" title="{{ .Title }}">
<dl>
Expand Down
22 changes: 16 additions & 6 deletions themes/huishou/layouts/page/news.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,17 @@
<div class="box-content">
{{ range first 10 ((where .Site.RegularPages "Params.hidden" "!=" true)) }}
{{ $content := .Content }}
{{ $matches := findRE `src="(https?://[^\"]+)"` $content -1 }}
{{ $matches := findRE `src="([^"]+)"` $content -1 }}
{{ $imageUrl := "https://cdn.jsdelivr.net/gh/lopinv/wooooden.com/static/assets/images/logo.png" }}
{{ if $matches }}
{{ $firstMatch := index $matches 0 }}
{{ $imageUrl = replaceRE `^src="` "" $firstMatch }}
{{ $imageUrl = replaceRE `"$` "" $imageUrl }}
{{ $extractedUrl := replaceRE `src="([^"]+)"` "${1}" $firstMatch }}
{{ if not (or (hasPrefix $extractedUrl "http://") (hasPrefix $extractedUrl "https://")) }}
{{ $baseUrl := .Site.BaseURL }}
{{ $imageUrl = printf "%s%s" $baseUrl $extractedUrl }}
{{ else }}
{{ $imageUrl = $extractedUrl }}
{{ end }}
{{ end }}
<a href="{{ .Permalink }}" target="_blank" title="{{ .LinkTitle }}">
<dl>
Expand Down Expand Up @@ -188,12 +193,17 @@
{{ range $index := $randomIndices }}
{{ $page := index $pages $index }}
{{ $content := $page.Content }}
{{ $matches := findRE `src="(https?://[^\"]+)"` $content -1 }}
{{ $matches := findRE `src="([^"]+)"` $content -1 }}
{{ $imageUrl := "https://cdn.jsdelivr.net/gh/lopinv/wooooden.com/static/assets/images/logo.png" }}
{{ if $matches }}
{{ $firstMatch := index $matches 0 }}
{{ $imageUrl = replaceRE `^src="` "" $firstMatch }}
{{ $imageUrl = replaceRE `"$` "" $imageUrl }}
{{ $extractedUrl := replaceRE `src="([^"]+)"` "${1}" $firstMatch }}
{{ if not (or (hasPrefix $extractedUrl "http://") (hasPrefix $extractedUrl "https://")) }}
{{ $baseUrl := .Site.BaseURL }}
{{ $imageUrl = printf "%s%s" $baseUrl $extractedUrl }}
{{ else }}
{{ $imageUrl = $extractedUrl }}
{{ end }}
{{ end }}
<a href="{{ $page.Permalink }}" target="_blank" title="{{ $page.Title }}">
<dl>
Expand Down

0 comments on commit 2797481

Please sign in to comment.