Skip to content

Commit

Permalink
chore(theme): 修改默认主题为dream 3.0.0版本
Browse files Browse the repository at this point in the history
  • Loading branch information
nineya committed Jul 29, 2023
1 parent 6784d7e commit 580b1d9
Show file tree
Hide file tree
Showing 28 changed files with 405 additions and 613 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@

## 三、版本适配关系

| 主题版本 | 适配Halo版本 | 测试用Halo版本 |
| ----------- | --------------------------- | -------------- |
| 主题版本 | 适配Halo版本 | 测试用Halo版本 |
|-------------| --------------------------- | -------------- |
| 1.x | 1.4.x及以下(不保证适配性) | 1.4.8 |
| 2.0.0-2.0.1 | 1.4.x | 1.4.8 |
| 2.0.2+ | 1.5.x ~ 1.6.1 | 1.6.1 |
| 2.0.2-2.3.1 | 1.5.x ~ 1.6.1 | 1.6.1 |


> 主题未在配置要求中对 Halo 最低版本限制得太死,但 Halo 不同版本开发接口略有不同,在不适配的版本中无法保证完全兼容。
Expand Down
53 changes: 26 additions & 27 deletions src/main/resources/templates/themes/halo-theme-dream/index.ftl
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<#include "template/layout.ftl">
<#global is_first_index=(posts.number == 0) >
<#macro model_build content>
<#if content == ''>
<#macro model_build option>
<#if !option??>
<#return>
</#if>
<#local content_option=content?split('|')>
<#local tag=(content_option[0]!'')?trim>
<#local content=((content_option[1]!'')?trim != '')?then('<div class="title">${content_option[1]?trim}</div>', '')>
<#local target=((content_option[2]!'false')?trim == 'true')?then('target="_blank"', '')>
<#local imageUrl=((content_option[3]!'')?trim != '')?then('style="background-image: url(${content_option[3]?trim})"', '')>
<#local targetUrl=((content_option[4]!'')?trim != '')?then('href="${content_option[4]?trim}"', '')>
<a class="card widget brightness ${(content!='')?then('bg-shadow', '')}" ${target} ${imageUrl} ${targetUrl}>${content}<div class="tag">${tag}</div></a>
<#local tag=((option.tag!'')?trim != '')?then('<div class="tag">${option.tag?trim}</div>', '')>
<#local title=((option.title!'')?trim != '')?then('<div class="title">${option.title?trim}</div>', '')>
<#local target=((option.target!'')?trim != '')?then(' target="${option.target?trim}"', ' target="_blank"')>
<#local imageUrl=((option.image!'')?trim != '')?then(' style="background-image: url(${option.image?trim})"', '')>
<#local targetUrl=((option.url!'')?trim != '')?then(' href="${option.url?trim}"', '')>
<a class="card widget brightness ${(title!='')?then('bg-shadow', '')}"${target}${imageUrl}${targetUrl}>${title}${tag}</a>
</#macro>
<@layout title="${blog_title!}" canonical="${blog_url!}">
<#if posts.content?? && posts.content?size gt 0>
Expand Down Expand Up @@ -44,15 +43,6 @@
</#list>
</#assign>
<#if settings.sidebar_column=='module-left' || settings.sidebar_column=='module-right'>
<#if settings.module_links?? && settings.module_links?trim != ''>
<#assign module_links=settings.module_links?split('\n')>
<#else>
<#assign module_links=[]>
<#list 0..1 as i>
<#assign post=posts[i]>
<#assign module_links=module_links+["推荐|${post.title!}|false|${post.thumbnail!}|${post.fullPath!}"]>
</#list>
</#if>
<div class="model model-index">
<div class="card widget swiper">
<div class="swiper-wrapper">${carousel_content}</div>
Expand All @@ -61,18 +51,27 @@
<div class="swiper-button-next"></div>
</div>
<div class="model model-index-side">
<#list 0..1 as i>
<#if i &lt; module_links?size >
<@model_build module_links[i]/>
</#if>
</#list>
<#if settings.module_options?? && settings.module_options?size &gt; 0>
<#list 0..1 as i>
<#if i &lt; settings.module_options?size >
<@model_build settings.module_options[i]/>
</#if>
</#list>
<#else>
<#list 0..1 as i>
<#if i &lt; posts.content?size >
<#assign postOption=posts.content[i]>
<@model_build {"tag": "推荐", "title": "${postOption.title!}", "url": "${postOption.fullPath}", "image": "${postOption.thumbnail}", "target": "_self"}/>
</#if>
</#list>
</#if>
</div>
</div>
<#if module_links?size &gt; 2 && module_links?size&lt;=6>
<div class="model model-attach model-attach-${module_links?size-2}">
<#if settings.module_options?? && settings.module_options?size &gt; 2 && settings.module_options?size&lt;=6>
<div class="model model-attach model-attach-${settings.module_options?size-2}">
<#list 2..5 as i>
<#if i &lt; module_links?size >
<@model_build module_links[i]/>
<#if i &lt; settings.module_options?size >
<@model_build settings.module_options[i]/>
</#if>
</#list>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#include "template/layout.ftl">
<@layout title="动态 - ${blog_title!}" canonical="${journals_url!}">
<@layout title="${journals_title!'动态'} - ${blog_title!}" canonical="${journals_url!}">
<#if journals.content?? && journals.content?size gt 0>
<#list journals.content as journal>
<div class="card card-content journal">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<#include "template/layout.ftl">
<@layout title="友链 - ${blog_title!}" canonical="${links_url!}">
<@layout title="${links_title!'友情链接'} - ${blog_title!}" canonical="${links_url!}">
<div class="card">
<#if settings.links_thumbnail?? && settings.links_thumbnail!=''>
<div class="card-image cover-image" style="background-image: url(${settings.links_thumbnail!})">
</div>
</#if>
<div class="card-content main">
<h1 class="title">友情链接 - ${user.nickname!}的小伙伴们</h1>
<h1 class="title">${links_title!'友情链接'} - ${user.nickname!}的小伙伴们</h1>
<div class="main-content">
<@linkTag method="listTeams">
<#assign defaultAvatar= (settings.links_default_avatar?? && settings.links_default_avatar!='')?string(settings.links_default_avatar!, static + "/source/img/avatar.svg") />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<#include "template/layout.ftl">
<@layout title="相册 - ${blog_title!}" canonical="${photos_url!}">
<@layout title="${photos_title!'我的相册'} - ${blog_title!}" canonical="${photos_url!}">
<#if (photos.content)?? && photos.content?size gt 0>
<div class="card card-content photos">
<div class="card-tab"><div>我的相册</div></div>
<div class="card-tab"><div>${photos_title!'我的相册'}</div></div>
<ul class="photos-teams">
<li class="item">全部</li>
<@photoTag method="listTeams">
Expand All @@ -16,7 +16,7 @@
<#else>
<div class="card card-empty">
<i class="fa fa-inbox"></i>
还没有上传过相册,回<a href="${context!}">主页</a>看看吧
内容为空,回<a href="${context!}">主页</a>看看吧
</div>
</#if>
</@layout>
145 changes: 145 additions & 0 deletions src/main/resources/templates/themes/halo-theme-dream/post_password.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<#include "template/layout.ftl">
<#include "template/main/article.ftl">
<@layout title="私密内容访问 - ${blog_title!}" canonical="${blog_url!}">
<style>
.post-password {
margin: 40px auto 64px auto;
padding: 20px;
max-width: 360px;
}
.post-password .title {
text-align: center;
}
.password-input {
position: relative;
margin-top: 32px;
}
.password-input input {
box-sizing: border-box;
width: 100%;
color: var(--main);
outline: none;
font-size: inherit;
font-family: inherit;
background-color: var(--bg-g);
padding: 0.5em 1em;
border: 1px solid transparent;
transition: background-color 0.3s ease-in-out;
}
.password-input span {
position: absolute;
background-color: var(--theme);
transition: transform 0.1s ease;
}
.password-input .bottom,
.password-input .top {
height: 1px;
left: 0;
right: 0;
transform: scaleX(0);
}
.password-input .left,
.password-input .right {
width: 1px;
top: 0;
bottom: 0;
transform: scaleY(0);
}
.password-input .bottom {
bottom: 0;
transform-origin: bottom right;
}
.password-input input:focus ~ .bottom {
transform-origin: bottom left;
transform: scaleX(1);
}
.password-input .right {
right: 0;
transform-origin: top right;
transition-delay: 0.05s;
}
.password-input input:focus ~ .right {
transform-origin: bottom right;
transform: scaleY(1);
}
.password-input .top {
top: 0;
transform-origin: top left;
transition-delay: 0.15s;
}
.password-input input:focus ~ .top {
transform-origin: top right;
transform: scaleX(1);
}
.password-input .left {
left: 0;
transform-origin: bottom left;
transition-delay: 0.25s;
}
.password-input input:focus ~ .left {
transform-origin: top left;
transform: scaleY(1);
}
.post-password button {
width: 100%;
position: relative;
font-size: inherit;
font-family: inherit;
color: white;
cursor: pointer;
padding: 0.5em 1em;
margin-top: 24px;
outline: none;
border: 1px solid transparent;
background-color: var(--theme);
}
.post-password button::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
border: 4px solid var(--theme);
transform-origin: center;
transform: scale(1);
}
.post-password button:hover::before {
transition: all 0.75s ease-in-out;
transform-origin: center;
transform: scale(1.75);
opacity: 0;
}
</style>
<div class="card">
<form class="post-password" method="post" action="${blog_url!}/content/${type!}/${slug!}/authentication">
<h2 class="title">私密内容访问</h2>
<div class="password-input">
<input type="password" name="password" placeholder="请输入访问密码">
<span class="bottom"></span>
<span class="right"></span>
<span class="top"></span>
<span class="left"></span>
</div>
<button type="submit">验证</button>
<div style="margin-top: 8px;color: red; text-align: center">${errorMsg!}</div>
</form>
</div>
</@layout>
Loading

0 comments on commit 580b1d9

Please sign in to comment.