EvanNotFound / hexo-theme-redefine

Simplicity in Speed, Purity in Design: Redefine Your Hexo Journey.
https://redefine.ohevan.com
GNU General Public License v3.0
1.28k stars 97 forks source link

[BUG] 每次 GitHub Repo 裡的 CNAME 都會被自動刪除 #357

Closed 1chooo closed 2 months ago

1chooo commented 3 months ago

提交 Issue 前检查清单

Bug 描述

我想為我的 Blog 換成我的域名,不過每次 GitHub Repo 裡的 CNAME 都會被自動刪除,導致出現 404 Error。

已經將 _config.redefine.ymlinfo.url 更換成我的 url https://blog.1chooo.com 同樣 config.ymlurl 也更換成我的 url https://blog.1chooo.com

复现方法

重新 deploy 到 github

hexo deploy

预期结果

github-page 這個 branch 的 CNAME 會保留

截图

Screenshot 2024-03-24 at 11 03 52 PM

电脑操作系统

macOS

浏览器

Brave

版本

v1.64.109

移动端设备

MacBook Pro 2020 intel

移动端操作系统

No response

浏览器

No response

版本

No response

其他

想問作者是如何把 Domain 更換成自己的?

1chooo commented 2 months ago

I write a new build.sh to replace with hexo deploy, and it successfully fixed this issue

#!/bin/bash
# Author: Hugo ChunHo Lin
# Date: 2024/03/30
# Version: v0.0.1

# Delete the gh-pages branch
git branch -D gh-pages

# Clean up the public folder
hexo clean

# Generate static files
hexo generate

# Clear the contents of .deploy_git folder
rm -rf .deploy_git/*

# Copy contents from public folder to .deploy_git folder
cp -r public/* .deploy_git/

# Create or overwrite CNAME file with desired content
echo "YOUR_OWN_DOMAIN" > .deploy_git/CNAME

# Commit and push changes to gh-pages branch
timestamp=$(date +"%Y-%m-%d %T")
commit_message="feat: site updated $timestamp"
cd .deploy_git || exit
git init
git add .
git commit -m "$commit_message"
git remote add origin <YOUR_REPOSITORY_URL>  # Replace <repository_url> with your actual repository URL
git checkout -b gh-pages
git push -u origin gh-pages