Hello Halo

相关链接

使用 Docker Compose 部署 Halo

  1. 创建halo文件夹
  2. 创建 docker-compose.yaml
version: "3"

services:
  halo:
    image: halohub/halo:1.5.3
    container_name: halo
    restart: on-failure:3
    volumes:
      - ./:/root/.halo
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "8090:8090"
    environment:
      - SERVER_PORT=8090
      - SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.h2.Driver
      - SPRING_DATASOURCE_URL=jdbc:h2:file:~/.halo/db/halo
      - SPRING_DATASOURCE_USERNAME=admin
      - SPRING_DATASOURCE_PASSWORD=o#DwN&JSa56
      - HALO_ADMIN_PATH=admin
      - HALO_CACHE=memory
  1. 启动 Halo 服务 docker-compose up -d
  2. nginx
upstream halo {
  server 127.0.0.1:8090;
}
server {
  listen 80;
  listen [::]:80;
  server_name www.yourdomain.com;
  client_max_body_size 1024m;
  location / {
    proxy_pass http://halo;
    proxy_set_header HOST $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

备忘

  • 开启了全站CDN后,有些功能异常,在又拍云开启参数跟随
  • 雪主题修改
  1. slogan改为今日诗词

    修改位置:/.halo/templates/themes/bao/index.ftl 22行

<#--  ${settings.home_description!}  注释原来的-->
<span id="jinrishici-sentence">正在加载今日诗词....</span><script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>
  1. 文章卡片添加展示分类

修改位置:/.halo/templates/themes/bao/module/widget/post_cards.ftl
copy展示标签的代码改一下变量。

<#if settings.post_card_category!false>
            <div class="text-sm h-5 overflow-hidden">
              <#if post.categories?size gt 0>
                    <#list post.categories as category>
<#--                  <#if category_index &lt; 1>-->
                    <a href="${category.fullPath!}" class="relative inline-block badge">
                      <i class="bg-red-400 opacity-10 absolute top-0 left-0 w-full h-full" style="background-color: ${category.color!'rgba(248,113,113,1)'}"></i>
                      <span class="badge-outline text-red-400 h-5 px-2 py-0.5 rounded-sm cursor-pointer"
                            style="color: ${category.color!'rgba(248,113,113,1)'}"
                            data-value="${category.name}">
                        ${category.name}
                      </span>
                    </a>
<#--                  </#if>-->
                </#list>
              </#if>
            </div>
 </#if>

然后在/.halo/templates/themes/bao/settings.yamlcopy一份标签的改成分类的,如下:

    post_card_category:
      name: post_card_category
      label: 卡片是否展示分类
      type: radio
      data-type: bool
      default: false
      options:
        - value: true
          label: 展示
        - value: false
          label: 隐藏