Freeze when running hugo server

Friends, today I had a problem with Use hugo server --gc --disableFastRender --cleanDestinationDir --port 13130 --logLevel debug.

After loading a few lines on the terminal page, it just keeps getting stuck there.

image-20240914182729430

D:\Obsidian\Blog>hugo server --gc --disableFastRender --cleanDestinationDir
port 1313 already in use, attempting to use an available port
Watching for changes in D:\Obsidian\Blog\{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in D:\Obsidian\Blog\config.yaml, D:\Obsidian\Blog\themes\PaperMod\hugo.yaml
Start building sites …
hugo v0.134.1-2f89169baa87a9db47e288b60705f4e99e21a945+extended windows/amd64 BuildDate=2024-09-05T10:17:50Z VendorInfo=gohugoio

^C
D:\Obsidian\Blog>hugo server --gc --disableFastRender --cleanDestinationDir --port 13130 --logLevel debug
Watching for changes in D:\Obsidian\Blog\{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in D:\Obsidian\Blog\config.yaml, D:\Obsidian\Blog\themes\PaperMod\hugo.yaml
Start building sites …
hugo v0.134.1-2f89169baa87a9db47e288b60705f4e99e21a945+extended windows/amd64 BuildDate=2024-09-05T10:17:50Z VendorInfo=gohugoio

INFO  static: removing all files from destination that don't exist in static dirs
INFO  static: syncing static files to \ duration 311.2889ms
INFO  build:  step process substep collect files 44 files_total 44 pages_total 44 resources_total 0 duration 2.3451ms
INFO  build:  step process duration 5.0888ms
INFO  build:  step assemble duration 2.578ms

There were no errors reported, I didn’t know what was wrong!
Later, friends I found, I can run at first, I put an article just from draft mode set to can draft:false, then I found stuck, I should go back and can again, may I ask why this problem occurs?

Requesting Help:

1 Like

Nadir-Echo/Blog (github.com)
this

I seem to have located the error
Under this file in content/posts/tech/YOLO-bounding-box-coordinate.md, add a link to the shortcode {{< innerlink src=“posts/tech/Golang-ai.md” >}}

image-20240914204103303After this, re-localize the hugo server --gc --disableFastRender --cleanDestinationDir and it will get stuck!

image-20240914204138674

诶哟,是老哥啊 :joy:,那我就可以用中文嘞。现在就不知道原因,是不是可能会是我短代码里面对于innerlink的定义出了问题?可是我其他所有用这个innerlink的地方并没有报错。

I am not familiar with shortcodes.

I can reproduce the server freezing in commit 5437eff by adding {{< innerlink src="posts/tech/Golang-ai.md" >}} to content/posts/tech/YOLO-bounding-box-coordinate.md.

If I remove {{< innerlink src="posts/tech/YOLO-bounding-box-coordinate" >}} in content/posts/tech/Golang-ai.md, hugo server works again.

推荐用英文发帖,这边用英文会比较多人回应。

1 Like
<div style="height: 200px;margin: 1em auto;position: relative;
        box-shadow: 0 2px 4px rgb(0 0 0 / 25%), 0 0 2px rgb(0 0 0 / 25%);
        border-radius: 15px;padding: 23px;max-width: 780px;background: var(--entry);">
    {{ $url := .Get "src" }}
    {{ with .Site.GetPage $url }}
    <div style="font-size: 22px; font-weight: 600">
        <a target="_blank" href="{{ .Permalink }}" style="box-shadow: none">{{ .Title }}</a>
    </div>
    <span style="font-size: 14px; color: #999">
        日期: {{ .Date.Format ( default "2006-01-02") }}
        {{ if .Params.tags }}&nbsp;
        标签:
        {{ range .Params.tags }}
            #{{ . }}&nbsp;
        {{ end }}
    </span>
    <div style="font-size: 14px; line-height: 1.825;max-height: 75px; overflow: hidden;margin-top: 5px;">
        {{ .Summary | plainify}} ......
    </div>
    {{ end }}
    {{ end }}
</div>

I think what happens is that the {{ .Summary }} at the end basically runs the shortcode again, which then runs the summary again, which runs the shortcode again ;).

One of the double {{ end }} probably have to go before the </span> tag.

1 Like