当前主题DoIt问题修改

Error: unable to cast []string{"胡兵"} of type []string to string.

ox-hugo exports the author frontmatter as a list (e.g., ["Name"]), but the DoIt theme templates expect a single string.

Modified the theme templates to check if author is a list (slice) and extract the first element if so.

  1. themes/DoIt/layouts/_partials/head/seo.html
  2. themes/DoIt/layouts/_partials/meta/author.html
  3. themes/DoIt/layouts/_partials/rss/item.html

Added the following logic to normalize the author variable:

{{- $authorParam := .Params.author -}}
{{- if reflect.IsSlice $authorParam -}}
    {{- if gt (len $authorParam) 0 -}}
        {{- $authorParam = index $authorParam 0 -}}
    {{- else -}}
        {{- $authorParam = nil -}}
    {{- end -}}
{{- end -}}
{{- /* Use $authorParam instead of .Params.author */ -}}

In item.html, I also had to fix a syntax error in the CDATA section by using backticks to avoid “unterminated quoted string” errors:

{{- `<![CDATA[` | safeHTML -}}
...
{{- `]]>` | safeHTML -}}