搭建一个永久免费的博客

发布于:2025-05-20 ⋅ 阅读:(16) ⋅ 点赞:(0)

搭建永久免费的博客(1)基本介绍

Hugo+Stack+GitHub

GitHub

GitHub

GitHub · Build and ship software on a single, collaborative platform · GitHub

下载安装git

Git - Downloads

Edge插件authenticator 2fa client

Settings->Password and authentication->Authenticator app->Edit

国内访问设置

# 打开 Hosts 文件(Windows 路径:C:\Windows\System32\drivers\etc\hosts)
notepad C:\Windows\System32\drivers\etc\hosts

# 添加以下内容
140.82.114.3 github.com
140.82.114.4 gist.github.com
151.101.1.194 github.global.SSL.fastly.net

# 保存文件后,刷新 DNS 缓存
ipconfig /flushdns

其他方法:使用加速器可以有效提高访问速度。推荐使用 Watt Toolkit(Steam++) 或 网易 UU 加速器

Hugo

Hugo v0.131.0

https://github.com/gohugoio/hugo

# 创建网站项目
hugo new site teacher_blog
# 启动服务
hugo server -D
# 创建文章
hugo new content post/about-me/index.md
hugo new content post/about-me/index.zh-cn.md

Stack

Stack v3.26.0

GitHub - CaiJimmy/hugo-theme-stack: Card-style Hugo theme designed for bloggers

Emoji

全部Emoji(3781) | EmojiAll

utterances

utterances

为Hugo构建的博客站点添加评论组件 - 简书

icons

Tabler Icons: 5900+ free vector icons for web design

iconfont-阿里巴巴矢量图标库

baseurl: freshman118.github.io
languageCode: en-us
theme: hugo-theme-stack
paginate: 5
title: 90后小陈老师
copyright: 90后小陈老师

# Theme i18n support
# Available values: ar, bn, ca, de, el, en, es, fr, hu, id, it, ja, ko, nl, pt-br, th, uk, zh-cn, zh-hk, zh-tw
DefaultContentLanguage: zh-cn

# Set hasCJKLanguage to true if DefaultContentLanguage is in [zh-cn ja ko]
# This will make .Summary and .WordCount behave correctly for CJK languages.
hasCJKLanguage: false

languages:
    zh-cn:
        languageName: 中文
        title: 90后小陈老师
        weight: 2
        params:
            description: 演示说明
services:
    # Change it to your Disqus shortname before using
    disqus:
        shortname: "hugo-theme-stack"
    # GA Tracking ID
    googleAnalytics:
        id:

permalinks:
    post: /p/:slug/
    page: /:slug/

params:
    mainSections:
        - post
    featuredImageField: image
    rssFullContent: true
    favicon: # e.g.: favicon placed in `static/favicon.ico` of your site folder, then set this field to `/favicon.ico` (`/` is necessary)

    footer:
        since: 2025
        customText: 

    dateFormat:
        published: 2006-02-02
        lastUpdated: 2006-02-02T13:18:50

    sidebar:
        emoji: 😁
        subtitle: 分享技术,享受生活
        avatar:
            enabled: true
            local: true
            src: img/avatar.jpg

    article:
        math: false
        toc: true
        readingTime: false

    comments:
        enabled: true
        provider: disqus

        disqusjs:
            shortname:
            apiUrl:
            apiKey:
            admin:
            adminLabel:

        utterances:
            repo:
            issueTerm: pathname
            label:

        beaudar:
            repo:
            issueTerm: pathname
            label:
            theme:        

        remark42:
            host:
            site:
            locale:

        vssue:
            platform:
            owner:
            repo:
            clientId:
            clientSecret:
            autoCreateIssue: false

        # Waline client configuration see: https://waline.js.org/en/reference/component.html
        waline:
            serverURL:
            lang:
            pageview:
            emoji:
                - https://unpkg.com/@waline/emojis@1.0.1/weibo
            requiredMeta:
                - name
                - email
                - url
            locale:
                admin: Admin
                placeholder:

        twikoo:
            envId:
            region:
            path:
            lang:

        # See https://cactus.chat/docs/reference/web-client/#configuration for description of the various options
        cactus:
            defaultHomeserverUrl: "https://matrix.cactus.chat:8448"
            serverName: "cactus.chat"
            siteName: "" # You must insert a unique identifier here matching the one you registered (See https://cactus.chat/docs/getting-started/quick-start/#register-your-site)

        giscus:
            repo:
            repoID:
            category:
            categoryID:
            mapping:
            lightTheme:
            darkTheme:
            reactionsEnabled: 1
            emitMetadata: 0

        gitalk:
            owner:
            admin:
            repo:
            clientID:
            clientSecret:

        cusdis:
            host:
            id:
    widgets:
        homepage:
            - type: search
            - type: archives
            # 显示归档年份数量
              params:
                  limit: 4
            - type: categories
              params:
                  limit: 10
            # - type: tag-cloud
            #   params:
            #       limit: 10
        page:
            - type: toc

    opengraph:
        twitter:
            # Your Twitter username
            site:

            # Available values: summary, summary_large_image
            card: summary_large_image

    defaultImage:
        opengraph:
            enabled: false
            local: false
            src:

    colorScheme:
        # Display toggle
        toggle: true

        # Available values: auto, light, dark
        default: auto

    imageProcessing:
        cover:
            enabled: true
        content:
            enabled: true

### Custom menu
### See https://stack.jimmycai.com/config/menu
### To remove about, archive and search page menu item, remove `menu` field from their FrontMatter
menu:
    main: []

    social:
        - identifier: github
          name: GitHub
          url: https://github.com/freshman118
          params:
              icon: brand-github

        - identifier: bilibili
          name: Bilibili
          url: https://space.bilibili.com/3493114532596161
          params:
              icon: brand-bilibili

related:
    includeNewer: true
    threshold: 60
    toLower: false
    indices:
        - name: tags
          weight: 100

        - name: categories
          weight: 200

markup:
    goldmark:
        renderer:
            ## Set to true if you have HTML content inside Markdown
            unsafe: true
    tableOfContents:
        endLevel: 4
        ordered: true
        startLevel: 2
    highlight:
        noClasses: false
        codeFences: true
        guessSyntax: true
        lineNoStart: 1
        lineNos: true
        lineNumbersInTable: true
        tabWidth: 4

上线

创建GitHub仓库

freshman118.github.io

hugo -D
cd public 

git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/freshman118/freshman118.github.io.git
git push -u origin main
git push -f origin main

# 取消代理
git config --global --unset http.proxy 
git config --global --unset https.proxy
hugo -D
cd public 
git add .
git commit -m "3 commit"
git push -u origin main


网站公告

今日签到

点亮在社区的每一天
去签到