Giter Site home page Giter Site logo

Comments (86)

kongjianyang avatar kongjianyang commented on May 30, 2024 2

通过你的这篇帖子建立了自己的网站,同时也阅读了你的一些文章,很好很激励人

from hongtaoh.github.io.

Ashleygua avatar Ashleygua commented on May 30, 2024 2

感谢博主教程

一个小细节,希望替碰到相似问题的读者节省一点时间

文件夹放在哪里

如果你用的是 Windows,打开你所选用的终端 ,比如 git bash, 输入:
cd 你刚才复制的路径

直接粘贴复制的路径类似于 $ cd C:\Users\my_project 会得到 "No such file or directory"
需要改成 $ cd /c/user/my_project (参考资料)

from hongtaoh.github.io.

CyrusYip avatar CyrusYip commented on May 30, 2024 2

cd 到有 config.toml 的文件夹。例如这样的:

❯ \ls -1
apply-no-comments-patch
archetypes
config.toml
content
cyrusyip-blog.Rproj
index.html
index.Rmd
LICENSE.md
netlify.toml
new-post.r
no-comments.diff
no-comments.toml
public
README.md
resources
script.sh
static
themes
vercel.json

from hongtaoh.github.io.

murbu avatar murbu commented on May 30, 2024 2

感谢感谢!我刚才是路径复制错了 根据上面的评论改一下路径的格式就好了

from hongtaoh.github.io.

Jiaxin-LI-10 avatar Jiaxin-LI-10 commented on May 30, 2024 1

重新照着做了一遍,已经解决了,谢谢博主🙏

from hongtaoh.github.io.

Jiaxin-LI-10 avatar Jiaxin-LI-10 commented on May 30, 2024 1

第一次做的时候,branch里面没有出现gh-pages选项,就先选了master;第二遍跟着做的时候,不知为何出现了gh-pages,就很顺利跟着教程做完了😂

from hongtaoh.github.io.

CyrusYip avatar CyrusYip commented on May 30, 2024 1

@hongtaoh 对。我一开始用 Netlify,后来因为在国内访问速度很慢就改成 Vercel 了。另外,Vercel 的重定向功能支持正则表达式,Netlify 的不支持。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024 1

@Archiemeng7 抱歉我无法指出问题在哪里。我建议从头到尾重新做一遍,一步一步跟着描述做,不要跳。我能确定的是如果你跟着做,不会出现问题,大概率是你哪一步没有按照我写的来。

from hongtaoh.github.io.

Archiemeng7 avatar Archiemeng7 commented on May 30, 2024 1

谢谢,一步一步又弄了一遍,细节问题,问题已解决,已建好站!

from hongtaoh.github.io.

murbu avatar murbu commented on May 30, 2024 1

@murbu 我知道你说的是什么了,但我没找到问题的解决方法,抱歉。我有几个别的方法:

  1. 把文章下面的「最后更新于」去掉,也就是说,把这里的:

{{ default (index .Site.Params.lang.lastupdate.Site.Params.defaultLang) (index .Site.Params.lang.lastupdate.Section)}} {{ .Page.Lastmod.Format "2006-01-02" }}

去掉

  1. 把我的个人网站克隆 (fork) 一下,在那个的基础上建你的网站,当然这会带来新的问题,也就是文章更新时间是网站更新时间(而不是那篇博客的更新时间)。
  2. 你自己花时间学一下 hugo,自己找一下问题~

了解了。感谢!

from hongtaoh.github.io.

cafferychen777 avatar cafferychen777 commented on May 30, 2024 1

其实可以根本不用终端操作, Just click will be fine.

from hongtaoh.github.io.

yujie-ren avatar yujie-ren commented on May 30, 2024 1

@hongtaoh,是的,我在国内;
我重新试了一下,博主的网站加载过的网页访问起来的确会快很多,但是没有点开过的网页打开依然很慢;金吉的网页没有这个问题,每个网页每次打开都很快;

我自己也用博主的主题搭了2个(分别在github上和netlify上),访问速度差异不明显,可能因为本身网站内容比较少。墙的问题目前没有遇到。

谢谢博主,收获很多~

from hongtaoh.github.io.

CyrusYip avatar CyrusYip commented on May 30, 2024 1

@yujie-ren @hongtaoh 可以用这个工具测试国内和国外的连接速度。

https://mping.chinaz.com/speedtest/

from hongtaoh.github.io.

cuidi1996 avatar cuidi1996 commented on May 30, 2024 1

按照学长的教程,以及查了其他的一些资料,终于搞懂了,然后搭建好了自己的网站,之前一直在赛博流浪,现在终于有了一块自留地。感恩! https://cuidi1996.github.io/

from hongtaoh.github.io.

cuidi1996 avatar cuidi1996 commented on May 30, 2024 1

说一下修改的地方,我的 workflow 是用的Pages > Build and deployment >Source>github actions 自带的hugo选项,另外一个是git push 这里一直push不上去,我直接选择了拖拽文件夹,之后的更新,选择下载了Github desktop,可以在界面内操作 commit和push,相比单纯写代码好用一点~

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024 1

@yzng2s 在 git push 之前有输入 git commit -m "your msg" 吗?如果有的话,我暂时也不知道是什么原因,建议你从头开始弄一遍。如果真的一步一步来的话,不应该有这个错误,很可能是哪一行代码漏了。

from hongtaoh.github.io.

yzng2s avatar yzng2s commented on May 30, 2024 1

敬爱的博主:我的博客已经可以在大约2分钟后就能更新内容了,太感谢你的文章。至上我崇高的敬意!

from hongtaoh.github.io.

yuzhao66 avatar yuzhao66 commented on May 30, 2024 1

谢谢博主的回复!我当时设置完hugo这个主题后生成的网页没有 home, post, 中文这些链接,还有点疑惑来着。后来按照你的教程一步步地把代码上传到github上生成的网页就正常了,就有这些链接了,再次感谢博主!!

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024 1

@gr8lawrence 谢谢你的关注。我把你的个人网站 git clone 到我本地,在本地预览是没问题的,我不知道你这个问题出在哪里。你为什么要手动复制 layouts 呢?大概率是这篇教程有哪个小步骤你没有做,建议你再看一下。另外,如果实在没办法,可以直接克隆 (fork) https://github.com/hongtaoh/hugo-ht-exampleSite ,在这个基础上改也可以。

from hongtaoh.github.io.

DuPractice avatar DuPractice commented on May 30, 2024 1

特别特别有帮助,已经建好了,感谢博主无私的分享!

from hongtaoh.github.io.

Qiushi-Zhou196 avatar Qiushi-Zhou196 commented on May 30, 2024 1

谢谢博主,已经做出来了~

from hongtaoh.github.io.

yuzhao66 avatar yuzhao66 commented on May 30, 2024 1

@yuzhao66 @GymRat102 感谢两位。我目前手头没有 windows 电脑,之后可能会买一台用来做教程,毕竟大多数人用 windows,不用 mac。感谢回复。

我推荐像我一样的小白用桌面端GitHub操作更方便一些,有时候在终端更新网页的时候不知道是不是因为科学上网的原因,会超时,用桌面端直接修改操作更简单🤣

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024 1

@TONGYUTONY66 这个貌似是操作系统不同导致的。

cp -r hugo-ht/* hugo-ht-new # copy everything in hugo-ht to hugo-ht-new
rm -rf hugo-ht # delete the folder of hugo-ht
mv hugo-ht-new hugo-ht # change folder name

这几行你可以手动弄,不要用代码。更具体的我之后会更新一下这个教程。

from hongtaoh.github.io.

joeliuz6 avatar joeliuz6 commented on May 30, 2024 1

我也是windows不显示导航栏,换老版本的hugo在windows就好了,用的0.121不行改了0.81

from hongtaoh.github.io.

Jiaxin-LI-10 avatar Jiaxin-LI-10 commented on May 30, 2024

一直跟着前面做,在这一步:“等一两分钟,当出现Your site is published at https://USERNAME.github.io/ 点开那个链接,你的网站应该就出现了。” 完成后,点开链接,网站页面显示“404 File not found”,请问博主知道是为什么吗?

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

重新照着做了一遍,已经解决了,谢谢博主🙏

方便说一下解决方法吗?也许之后看到的读者会用到。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

第一次做的时候,branch里面没有出现gh-pages选项,就先选了master;第二遍跟着做的时候,不知为何出现了gh-pages,就很顺利跟着教程做完了😂

应该是你第一遍做的时候,workflow 部分的问题:

- name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.PERSONAL_TOKEN }}
          publish_branch: gh-pages
          publish_dir: ./public

不过解决了就好!

from hongtaoh.github.io.

KristenJZ avatar KristenJZ commented on May 30, 2024

博主你好!在做的时候branch中没有出现gh-pages选项,已经照着教程做了3遍了,并查看了syntax有无问题。发现在添加workflow后,上传到github时,反复出现以下错误代码,不知是哪里出现了问题,故想要向你请教:
xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).

from hongtaoh.github.io.

QiuHeqian avatar QiuHeqian commented on May 30, 2024

博主,你好,我也做了3遍了,还是没有出现gh-pages选项,想问一下是workflow的什么问题呀?

  • name: Deploy
    uses: peaceiris/actions-gh-pages@v3
    with:
    github_token: ${{ secrets.PERSONAL_TOKEN }}
    publish_branch: gh-pages
    publish_dir: ./public

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

博主你好!在做的时候branch中没有出现gh-pages选项,已经照着教程做了3遍了,并查看了syntax有无问题。发现在添加workflow后,上传到github时,反复出现以下错误代码,不知是哪里出现了问题,故想要向你请教: xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).

我猜测应该还是 workflow 这里的有问题。我看你的报错,想不出来是哪里的问题。我想问下,你用的是苹果系统还是微软系统?另外,你能否把你做的每一步详细写下来。在评论区或者作成一个 pdf 发给我都可以。如果我看不到你之前每一步是怎么做的,我无法指出是哪里出错了。另外,你可以把你现有的部分上传到 https://github.com/KristenJZ/KristenJZ.github.io,我看下是否有问题。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

博主,你好,我也做了3遍了,还是没有出现gh-pages选项,想问一下是workflow的什么问题呀?

* name: Deploy
  uses: peaceiris/actions-gh-pages@v3
  with:
  github_token: ${{ secrets.PERSONAL_TOKEN }}
  publish_branch: gh-pages
  publish_dir: ./public

我看到你已经解决问题了。能否分享一下怎么解决的?

from hongtaoh.github.io.

KristenJZ avatar KristenJZ commented on May 30, 2024

博主你好 根据几周的摸索,我已经解决了无法出现gh-pages的问题,现在更新如下:1)一开始没有出现是gh-pages并出现的错误代码(unable to load libxcrun)是因为我是一个编程小白,我没有安装developer tool。这一步出现问题,安装会比较耗时,预计安装时间在7小时左右。2)此外,当配置好时,即使已经出现自己的网页,但是仍然需要等待10min左右,pages那里才会出现gh-pages的选项。

但是我这边有一些新的问题。1) 我在更新内容时,已经陆续新增了一个cn/post,删改了about中的内容,并修改了主页的内容。但是在我运行更新并显示everything up to date后,我的网站上只更新了about中的内容,其他地方都没有出现。然而在我查看github的repository时,这些更新是已经到了repository中的,只是没有更新到页面。这令我非常困惑。2)此外,主页中下方会呈现博主你的主页下的comment,非常困惑,不知道怎么把这部分的comment去掉,或者修改为自己的comment。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@KristenJZ 原来是你!能花几个礼拜自习学,非常不容易!你说的 developer tool 是什么?我怎么不记得需要它?

我在你的基础上改了改,现在我能看到你新加的内容。我看到你最新的一次部署失败了。失败的原因是你 _index.md 中你添加图片的代码是错误的。我帮你改好了。

from hongtaoh.github.io.

KristenJZ avatar KristenJZ commented on May 30, 2024

谢谢你的回复!我这两天把这个更新好了。关于developer tool的问题,是我把报错的这段code放到stackoverflow上搜索,发现问题是我并没有安装xcode(https://stackoverflow.com/questions/66064033/unable-to-run-git-on-mac-os-big-sur),所以重新进行了安装。这个时间大概需要7个小时。我在整个过程中作为小白遇到了蛮多问题的,我会写一个说明帮助后来者~

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@KristenJZ 感谢!我不知道苹果系统没有自带 Git,可能是我之前装了,就忘了。我看了看,你不需要安装那么大的 Xcode,只需要在 Terminal 中输入 xcode-select --install 来安装 Xcode Command Line Tools。然后,在 terminal 中输入 git --version 就好。这一点我已经更新了

from hongtaoh.github.io.

CyrusYip avatar CyrusYip commented on May 30, 2024

一些建议:

  • 可以用 Vercel 代替 GitHub Action,这样会简单很多
  • 域名注册可以选择 Porkbun 和 Cloudflare Registrar,比 Namecheap 更 cheap

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@CyrusYip 感谢建议!Vercel 我不熟悉,不过感兴趣的看官可以去试试!GitHub Action 确实比较麻烦,不过好在一劳永逸。域名的话,我看了一下,价格都差不多,没有谁比谁便宜。Cloudflare 需要先注册才能看,我就没有再继续看了。

from hongtaoh.github.io.

CyrusYip avatar CyrusYip commented on May 30, 2024

@hongtaoh 先把网站源代码上传到 GitHub,然后在 Vercel 选择对应的仓库就完成部署了,就是点几下鼠标的事情。唯一需要设置的就是 Hugo 版本,Vercel 默认使用很老的 Hugo,具体版本我不记得了。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@CyrusYip 我懂了。那应该是和 Netlify 一个道理。

from hongtaoh.github.io.

yaoronger avatar yaoronger commented on May 30, 2024

您好 我在Hugo那一步的网址怎么都打不开 http://localhost:1313

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@yaoronger 只看你的描述的话,我没办法指出哪一步出错了。你试试从头开始重新做一遍,可能是哪个步骤你没有弄对。或者你可以把你的内容上传到 github 我看一下。

from hongtaoh.github.io.

yaoronger avatar yaoronger commented on May 30, 2024

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@yaoronger 只看这个的话我还是帮不到你。如果你能上传到 github 的话我可以帮忙看下。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@yaoronger 如果还需要帮助,你可以看看这里

from hongtaoh.github.io.

murbu avatar murbu commented on May 30, 2024

感谢博主 已经把网站建好了
但是在新建帖子的时候遇到了问题
我应该cd到哪个hugo文件夹?
每次新建的时候就会遇到这样的报错
Error: Unable to locate config file or config directory. Perhaps you need to create a new site.
Run hugo help new for details.

from hongtaoh.github.io.

Archiemeng7 avatar Archiemeng7 commented on May 30, 2024

mengw@MengArchie MINGW64 /d/quickstart (master)
$ git push -u origin master
remote: Repository not found.
fatal: repository 'https://github.com/Archiemeng7/Archiemeng7.github.io.git/' not found
请问这是什么问题呀,卡在建站最后一步

from hongtaoh.github.io.

murbu avatar murbu commented on May 30, 2024

有遇到一个问题:为什么博客的内容每次更新,但是最下面的”最后一次更新于“却不会跟着一起更新呢?

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@murbu 我看到你的问题已经解决,对吧?

from hongtaoh.github.io.

murbu avatar murbu commented on May 30, 2024

@murbu 我看到你的问题已经解决,对吧?

还没有解决 更新过几次的博客 显示的最后一次更新时间还是第一次创建博客的时间

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@murbu 我知道你说的是什么了,但我没找到问题的解决方法,抱歉。我有几个别的方法:

  1. 把文章下面的「最后更新于」去掉,也就是说,把这里的:

{{ default (index $.Site.Params.lang.lastupdate $.Site.Params.defaultLang) (index $.Site.Params.lang.lastupdate $.Section)}} {{ .Page.Lastmod.Format "2006-01-02" }}

去掉

  1. 把我的个人网站克隆 (fork) 一下,在那个的基础上建你的网站,当然这会带来新的问题,也就是文章更新时间是网站更新时间(而不是那篇博客的更新时间)。

  2. 你自己花时间学一下 hugo,自己找一下问题~

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@Archiemeng7 抱歉,我无法理解你提到的这个问题,也不知道如何解决~

from hongtaoh.github.io.

yujie-ren avatar yujie-ren commented on May 30, 2024

谢谢博主的教程,非常有用。
还想请教一个问题,每次登陆博主的网页都很慢,但是登陆金吉的网站就快很多,这是因为部署方式不同吗(金吉部署在netlify上)?还是因为博主的网页内容量比金吉的更多一些?

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@yujie-ren 你在国内是吗?我在国内登过我的网站,初始页面加载很慢,但之后再打开就比较快了。你这样每次都很慢我不知道是为什么。

但是登陆金吉的网站就快很多,这是因为部署方式不同吗

是的。我猜也是因为部署方式不同导致的。我用的是 github pages,因为 github 在国内访问很慢,所以导致我的网站加载也比较慢(我的猜测)。netlify 可能会好点,但我没试过,也不知道。有伙计用 vercel 貌似也比较快。你可以试试看哪个更快。这几个 github pages 比较麻烦一点,其他两个用起来比较简单。我当时是怕 netlify 被墙,所以用的 github pages。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@yujie-ren 这就奇怪了。我也不晓得问题出在哪里。网页加载慢对一个网站是致命的... 没人会等三秒钟。我暂时还没想到办法,换到 netlify 或者 vercel 应该会好一些。至于是不是因为我网站内容过多导致的,这个我也不知道。我的网站上确实有不少非文本的内容,比如 pdf 和 图片。也可能跟这个有关系。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@cuidi1996 很开心看到你的网站上线。git push 不成功,我猜是 token 或者 secrets 没弄好的缘故,但你找到自己能用的方式就好,如果之后拖拽烦了,可以再看看怎么直接用代码实现。你的网站做得很好!

我可以把你的网站分享给别人吗?

from hongtaoh.github.io.

cuidi1996 avatar cuidi1996 commented on May 30, 2024

@cuidi1996 很开心看到你的网站上线。git push 不成功,我猜是 token 或者 secrets 没弄好的缘故,但你找到自己能用的方式就好,如果之后拖拽烦了,可以再看看怎么直接用代码实现。你的网站做得很好!

我可以把你的网站分享给别人吗?

可以的,非常荣幸!

from hongtaoh.github.io.

yzng2s avatar yzng2s commented on May 30, 2024

请问博主:我在mac的终端输入:git push -u origin master命令后,就出现了如下红色字体:error: failed to push some refs to 'https://github.com/yzng2s/yzng2s.github.io.git',我也查询了一些信息,但是仍然未能找到很好的解决办法,特向你请教

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@murbu 上面提到的最后一次更新于这个问题已经解决了,改动为:.github/workflows/gh-pages.yml 中 fetch-depth:0

from hongtaoh.github.io.

yuzhao66 avatar yuzhao66 commented on May 30, 2024

博主你好!请问在网站主题的最后一步出现这个问题是为什么呀,应该如何修改~
$ hugo server -D
Start building sites …
hugo v0.112.3-ba6f74e40420d76f15fc8c2358be90f7aca98e0e windows/amd64 BuildDate=2023-05-24T14:42:50Z VendorInfo=gohugoio
Built in 121 ms
Error: error building site: assemble: "D:\quickstart\content\en\about_index.md:5:1": failed to extract shortcode: template for shortcode "block" not found

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@zoeyyuzhao 我的猜测是 config.toml 种的 theme 你用的不是 hugo-ht 这个主题,但没看到你的代码我没办法确定。

from hongtaoh.github.io.

yuzhao66 avatar yuzhao66 commented on May 30, 2024

谢谢博主,我是按照教程一步步来的,就是修改了个人路径放在了d盘。这个是做的过程中的代码,可以帮忙看一下吗?我反复重新做了好几遍都是这个样子,不知道为什么
13599@xiaonongnv MINGW64 ~
$ cd /d/

13599@xiaonongnv MINGW64 /d
$ hugo new site quickstart
Congratulations! Your new Hugo site is created in D:\quickstart.

Just a few more steps and you're ready to go:

  1. Download a theme into the same-named folder.
    Choose a theme from https://themes.gohugo.io/ or
    create your own with the "hugo new theme " command.
  2. Perhaps you want to add some content. You can add single files
    with "hugo new <FILENAME>.".
  3. Start the built-in live server via "hugo server".

Visit https://gohugo.io/ for quickstart guide and full documentation.

13599@xiaonongnv MINGW64 /d
$ cd quickstart/themes
git clone https://github.com/hongtaoh/hugo-ht
mkdir hugo-ht-new # create a new folder called hugo-ht-new
cp -r hugo-ht/* hugo-ht-new # copy everything in hugo-ht to hugo-ht-new
rm -rf hugo-ht # delete the folder of hugo-ht
mv hugo-ht-new hugo-ht # change folder name
cd ..
cp -r themes/hugo-ht/exampleSite/* . # copy everything in the exampleSite folder to quickstart
cp -r themes/hugo-ht/archetypes . # replace the archetypes folder
Cloning into 'hugo-ht'...
remote: Enumerating objects: 276, done.
remote: Counting objects: 100% (276/276), done.
remote: Compressing objects: 100% (177/177), done.
remote: Total 276 (delta 124), reused 235 (delta 83), pack-reused 0
Receiving objects: 100% (276/276), 304.88 KiB | 907.00 KiB/s, done.
Resolving deltas: 100% (124/124), done.

13599@xiaonongnv MINGW64 /d/quickstart
$

13599@xiaonongnv MINGW64 /d/quickstart
$ hugo server -D
Start building sites …
hugo v0.112.3-ba6f74e40420d76f15fc8c2358be90f7aca98e0e windows/amd64 BuildDate=2023-05-24T14:42:50Z VendorInfo=gohugoio
Built in 124 ms
Error: error building site: assemble: "D:\quickstart\content\en\about_index.md:5:1": failed to extract shortcode: template for shortcode "block" not found

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@zoeyyuzhao 我自己试了一下,我这里是可以的,说明主题代码没问题。我看了你贴的代码,但是我不知道是哪里的问题。你可以试试代码一行运行完再复制、粘贴、运行下一行。

from hongtaoh.github.io.

yuzhao66 avatar yuzhao66 commented on May 30, 2024

谢谢博主,我刚刚一行一行地运行了还是这个问题,不知道为什么在这里困住了好久,我试了下其他主题也还是这个问题

from hongtaoh.github.io.

yuzhao66 avatar yuzhao66 commented on May 30, 2024

我搜索了一下错误代码,看到了别人的解决方案,在出错的命令里面加上空格就好了https://djangocas.dev/blog/hugo/hugo-escape-shortcode-in-markdown/
但是我还是没能运行成功,太艰难了, http://localhost:1313/显示page not found
hugo v0.112.3-ba6f74e40420d76f15fc8c2358be90f7aca98e0e+extended windows/amd64 BuildDate=2023-05-24T14:42:50Z VendorInfo=gohugoio
WARN 2023/05/28 18:42:37 found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2023/05/28 18:42:37 found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN 2023/05/28 18:42:37 found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

from hongtaoh.github.io.

yuzhao66 avatar yuzhao66 commented on May 30, 2024

啊!!博主我成功了!我看了这个错误代码后,发现quickstart里面layouts是空的,不知道为什么没有复制过来。然后我把themes里面的layouts文件夹和static文件夹复制到quickstart里了,然后就成功了。但是有个问题是不知道为什么我的右上方是没有那些链接的

from hongtaoh.github.io.

yzng2s avatar yzng2s commented on May 30, 2024

@hongtaoh 你好,我找到在更新网页内容时到问题所在,我将gh-pages.yml文件中的master改为main后,并且用git push -u origin main(根据我查阅的资料,貌似博主的更新方式都不能用了,至少我这里进行了尝试,无法使用),可以实现将内容同步到github,但是却无法访问我的网页:https://yzng2s.github.io,访问时显示404,请教博主指导一下

from hongtaoh.github.io.

yzng2s avatar yzng2s commented on May 30, 2024

敬爱的博主:经过几次查询并试验后,发现只需要在建立仓库之前就在设置之中,将Repositories中的main改为master,然后update即可完全参照博主的模板进行,经测试可以实现。总而言之,我的建立过程非常曲折,终于成功了!https://yzng2s.github.io
另外,请教博主,为什么在更新内容后,需要很长一段时间网页上的内容才会更新,是原本github就是如此,还是我的操作存在一定的漏洞,恳请指导。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@zoeyyuzhao 恭喜!我正想发给你,如果还不成功,你可以直接 git clone 这里

我看了这个错误代码后,发现quickstart里面layouts是空的,不知道为什么没有复制过来

这个我也很困惑,不知道是不是 windows 上的终端无法识别其中一行的指令。我不清楚。

但是有个问题是不知道为什么我的右上方是没有那些链接的

我看了你的网站,https://zoeyyuzhao.github.io/,正常啊。不知道你说的是哪些链接。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@yzng2s 你提到的这个 main 和 master,不是个问题。这篇帖子中一直用的都是 master:

git push -u origin master

这行代码就表示分支的名字是 master,不是 main。

将Repositories中的main改为master,然后update即可完全参照博主的模板进行

我猜你是按照 github 给的代码运行的,所以有误 (但这篇帖子中没有提到按照 github 的指令来)。

为什么在更新内容后,需要很长一段时间网页上的内容才会更新,是原本github就是如此,还是我的操作存在一定的漏洞

五分钟以内的话是正常的~

from hongtaoh.github.io.

gr8lawrence avatar gr8lawrence commented on May 30, 2024

博主你好!非常感谢这篇教程,内容十分详细~我除了开始时遇到 @zoeyyuzhao 一样的问题,需要手动复制 layouts 文件夹,后来直到 publish 都很顺利,只不过网站上线后发现 header 上的那一些目录(Hugo logo, home, post, ...) 还是没有生成(https://gr8lawrence.github.io/, 之前在本地用 hugo server -D 也没看到。已经修改了 config.toml 和 hugo.toml,但是这个没有变化,不知道博主能不能帮着分析一下可能的原因?

from hongtaoh.github.io.

gr8lawrence avatar gr8lawrence commented on May 30, 2024

谢谢博主回复!我需要手动复制的原因是在完成把hugo-ht中的exampleSite/*archetypes搬到网站母文件夹里这一步后,母文件夹layouts文件夹会是空的(即自生成new site 后都是空的)。如果不复制的话直接hugo server -D会出现下列报错

Error: error building site: assemble: "/Users/gr8lawrence/Documents/personal_website/remake/content/en/about/_index.md:5:1": failed to extract shortcode: template for shortcode "block" not found

这篇文章的码好像并没有复制这个layouts文件夹一说(难道Hugo按理应给会自动生成layouts?小白的我不太懂),但是手动复制后,在本地跑网站会出现一样的问题:上头的目录都是空白。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@gr8lawrence 按理说 quickstart 文件夹中 layouts 是空的没关系,因为 themes/hugo-ht 里有 layouts。我目前不清楚为什么你不手动复制的话会出现你提到的错误。

from hongtaoh.github.io.

GymRat102 avatar GymRat102 commented on May 30, 2024

博主你好,我同样遇到和 @gr8lawrence 以及 @yuzhao66 一样的问题。按照步骤操作就会遇到以下报错:

Error: error building site: assemble: "<my-home-dir>/d/quickstart/content/en/about/_index.md:5:1": failed to extract shortcode: template for shortcode "block" not found

当我把 themes/hugo-ht 中的 layouts 和 static 文件夹 cp -r 到网站根目录之后,就可以跑起来了,虽然也出现了顶部没有导航栏。(PS:关于为什么要手动复制,因为 hugo-ht 下面,exampleSite 和 layouts, static 三个文件夹是平行的,所以 cp -r themes/hugo-ht/exampleSite/* . 不会把它们复制出去的)

我再花时间看看怎么解决这个问题(因为主题不是这篇博客的重点),但我确实也遇到了这个问题。


另外,我不太理解为什么要做以下步骤:

mkdir hugo-ht-new # create a new folder called hugo-ht-new
cp -r hugo-ht/* hugo-ht-new # copy everything in hugo-ht to hugo-ht-new
rm -rf hugo-ht # delete the folder of hugo-ht
mv hugo-ht-new hugo-ht # change folder name

我理解可以直接 clone 下来之后继续下面的操作,不需要创建一个新文件夹再移动内容,然后重命名回去。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@GymRat102 第一个问题我现在还不知道是怎么回事,我之后可能会做一期视频来讲。第二个问题,是因为直接 git clone 下来的话,上传会遇到一些问题,因为原始的 .git 信息在里面。肯定有更好的处理方法,但我图省事,就用了最简单粗暴的方法。

from hongtaoh.github.io.

GymRat102 avatar GymRat102 commented on May 30, 2024

我没有走到后面的步骤,忽略了.git的存在,谢谢回复。第一个问题真的很奇怪,如果需要一个复现案例的话,我也可以帮忙重现一下。

from hongtaoh.github.io.

yuzhao66 avatar yuzhao66 commented on May 30, 2024

第一个问题可能跟操作系统有关。我第一次是用Windows做的,后来换了新电脑,用Mac做就不需要手动复制了。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@yuzhao66 @GymRat102 感谢两位。我目前手头没有 windows 电脑,之后可能会买一台用来做教程,毕竟大多数人用 windows,不用 mac。感谢回复。

from hongtaoh.github.io.

jiahuiSophia avatar jiahuiSophia commented on May 30, 2024

Hongtao学长你好!感谢你的教程。我跟着教程做了几遍,仍然无法在branch里面找到gh-pages。terminal里面显示:
Reinitialized existing Git repository in C:/Users/XXX/Desktop/quickstart/.git/
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
error: remote origin already exists.
Everything up-to-date
branch 'master' set up to track 'origin/master'.
请问如何解决?谢谢

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@jiahuiSophia 问题可能是你每次重新做的时候没有删除之前的 username.github.io 这个仓库。你可以试试每次删除并重建这个仓库。

from hongtaoh.github.io.

TONGYUTONY66 avatar TONGYUTONY66 commented on May 30, 2024

学长你好,我在最开始的时候就遇到了问题。

我一次性全部复制您的新建hugo建立代码并运行后:

“cd quickstart/themes
git clone https://github.com/hongtaoh/hugo-ht
mkdir hugo-ht-new # create a new folder called hugo-ht-new
cp -r hugo-ht/* hugo-ht-new # copy everything in hugo-ht to hugo-ht-new
rm -rf hugo-ht # delete the folder of hugo-ht
mv hugo-ht-new hugo-ht # change folder name
cd ..
cp -r themes/hugo-ht/exampleSite/* . # copy everything in the exampleSite folder to quickstart
cp -r themes/hugo-ht/archetypes . # replace the archetypes folder”

打开http://localhost:1313/,却无法显示网站,终端报错如下:

Error: error building site: assemble: "/Users/xxxx/Desktop/quickstart/content/en/about/_index.md:5:1": failed to extract shortcode: template for shortcode "block" not found

这时候我发现桌面上的quick start文件夹里的layouts 和 content文件夹里是没有东西,好像没有自动复制进去还是咋的。

当我手动将hongtao文件夹里的content, layouts这些更新替换quickstart里面的相同文件夹,网站倒是可以显示了,但缺斤少两:只有小狗图片和下面的文字,右上角的导航bar是没有的。

想请教学长我后续应该如何操作,感谢!

from hongtaoh.github.io.

TONGYUTONY66 avatar TONGYUTONY66 commented on May 30, 2024

一直跟着前面做,在这一步:“等一两分钟,当出现Your site is published at https://USERNAME.github.io/ 点开那个链接,你的网站应该就出现了。” 我一直没有等到这句话,也没有看到能点击gh-pages的选项。

git init
git add .
git commit -m "first commit."
git remote add origin https://github.com/TONGYUTONY66/TONGYUTONY66.github.io.git
git push -u origin main
Initialized empty Git repository in /Users/tongyu66/Desktop/quickstart/.git/
warning: adding embedded git repository: themes/hugo-ht
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add themes/hugo-ht
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached themes/hugo-ht
hint:
hint: See "git help submodule" for more information.
[main (root-commit) b77443f] first commit.
42 files changed, 1089 insertions(+)
create mode 100644 .DS_Store
create mode 100644 .github/workflows/gh-pages.yml
create mode 100644 .hugo_build.lock
create mode 100644 archetypes/default.md
create mode 100644 config.toml
create mode 100644 content/_index.md
create mode 100644 content/cn/_index.md
create mode 100644 content/cn/about/_index.md
create mode 100644 content/cn/posts/2021-01-07-beiying.md
create mode 100644 content/cn/posts/2021-01-07-intro.md
create mode 100644 content/cn/posts/_index.md
create mode 100644 content/en/_index.md
create mode 100644 content/en/about/_index.md
create mode 100644 content/en/posts/2021-01-07-road.md
create mode 100644 content/en/posts/2021-01-07-test.md
create mode 100644 content/en/posts/_index.md
create mode 100644 hugo.toml
create mode 100644 layouts/404.html
create mode 100644 layouts/_default/_markup/render-link.html
create mode 100644 layouts/_default/list.html
create mode 100644 layouts/_default/single.html
create mode 100644 layouts/_default/terms.html
create mode 100644 layouts/list-single/list.html
create mode 100644 layouts/partials/add-header-anchors.html
create mode 100644 layouts/partials/foot_custom.html
create mode 100644 layouts/partials/footer.html
create mode 100644 layouts/partials/head_custom.html
create mode 100644 layouts/partials/header.html
create mode 100644 layouts/partials/nav.html
create mode 100644 layouts/robots.txt
create mode 100644 layouts/shortcodes/bilibili.html
create mode 100644 layouts/shortcodes/block.html
create mode 100644 layouts/shortcodes/column.html
create mode 100644 layouts/shortcodes/columns.html
create mode 100644 layouts/shortcodes/end.html
create mode 100644 layouts/shortcodes/endcolumn.html
create mode 100644 layouts/shortcodes/figure-a.html
create mode 100644 layouts/shortcodes/figure.html
create mode 100644 layouts/shortcodes/reminder.html
create mode 100644 netlify.toml
create mode 100644 themes/.DS_Store
create mode 160000 themes/hugo-ht
Username for 'https://github.com': tongyutony66
Password for 'https://[email protected]':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/TONGYUTONY66/TONGYUTONY66.github.io.git/'
tongyu66@TongYuMacBook-Air quickstart % git remote add origin https://tongyutony66:[email protected]/TONGYUTONY66/TONGYUTONY66.github.io.git

error: remote origin already exists.

它终端显示是这样的,求学长指教。我也做了两遍了,就是显示不出来。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@TONGYUTONY66 出现这个问题 “adding embedded git repository: themes/hugo-ht” 大概率是因为

cp -r hugo-ht/* hugo-ht-new # copy everything in hugo-ht to hugo-ht-new
rm -rf hugo-ht # delete the folder of hugo-ht
mv hugo-ht-new hugo-ht # change folder name

这几行代码在 windows 中无法正常运行。像我上次提到的那样,你可以问下 chatgpt 这几行代码是做什么的,然后你手动把这些做了,而不是用代码实现。我这个方法很 hecky 不是特别好。

from hongtaoh.github.io.

Liangduoyuan avatar Liangduoyuan commented on May 30, 2024

博主您好,新人小白想请教下,我到了 brunch 那一步也不显示gh-pages选项,然后我就把库删了重新来一遍,但是到了 depoy key 这一步时生成 key 就显示Key is already in use,但是我已经把原来的库都删了,这该怎么操作呢?我问 chatgpt 也没能解决。

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@Liangduoyuan 这个问题我暂时回答不了你。我估计和 windows 操作系统有关系。我之后打算做个视频,这样更清楚一些。

from hongtaoh.github.io.

zhidacaishu avatar zhidacaishu commented on May 30, 2024

你好,请问一下你介绍的这种github+hugo的博客搭建方式,能把obsidian软件的markdown格式笔记复制上来直接发布吗?主要是我的笔记有很多公式,尝试了wordpress搭建博客,感觉对带公示的markdown笔记不太友好

from hongtaoh.github.io.

hongtaoh avatar hongtaoh commented on May 30, 2024

@zhidacaishu 好问题。我写过一篇帖子:https://hongtaoh.com/en/2022/05/11/obsedian-mathjax-hugo-convert/

主要针对的就是公示转换问题。但需要手动操作参与。

from hongtaoh.github.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.