Skip to content

Add PaperMod extend_head.html fallback to _partials path#278

Merged
ashishb merged 2 commits into
mainfrom
copilot/add-fallback-for-output-head-file
May 13, 2026
Merged

Add PaperMod extend_head.html fallback to _partials path#278
ashishb merged 2 commits into
mainfrom
copilot/add-fallback-for-output-head-file

Conversation

Copilot AI commented May 12, 2026

Copy link
Copy Markdown
Contributor

PaperMod variants differ in where extend_head.html lives. When themes/PaperMod/layouts/partials/extend_head.html is unavailable, font setup now falls back to themes/PaperMod/layouts/_partials/extend_head.html instead of failing.

  • Fallback behavior in custom font setup

    • Updated head-file write flow in internal/hugogenerator/hugo_custom_font.go.
    • setupFont now attempts the primary path first, and retries with _partials only when the primary write fails due to missing path.
  • Coverage for both layout variants

    • Added internal/hugogenerator/hugo_custom_font_test.go with focused cases for:
      • primary layouts/partials path present
      • fallback layouts/_partials path present while primary path is absent
  • Implementation shape

    • Introduced a dedicated helper to centralize head-file write + fallback handling.
err := appendFile(filepath.Join(siteDir, _outputHeadFile), data)
if err == nil || !errors.Is(err, os.ErrNotExist) {
    return err
}
return appendFile(filepath.Join(siteDir, _outputHeadFileFallback), data)

Agent-Logs-Url: https://github.com/ashishb/wp2hugo/sessions/0eecccec-7cad-425c-9ba5-ee28be9c4cd3

Co-authored-by: ashishb <389236+ashishb@users.noreply.github.com>
@ashishb

ashishb commented May 12, 2026

Copy link
Copy Markdown
Owner

@copilot fix Error: /home/runner/work/wp2hugo/wp2hugo/src/wp2hugo/internal/hugogenerator/hugo_custom_font.go:18:1: File is not properly formatted (gofumpt) with src/wp2hugo $ make format

Copilot AI commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix Error: /home/runner/work/wp2hugo/wp2hugo/src/wp2hugo/internal/hugogenerator/hugo_custom_font.go:18:1: File is not properly formatted (gofumpt) with src/wp2hugo $ make format

Fixed in a9db880 by running make format in src/wp2hugo, which applied the gofumpt formatting update in hugo_custom_font.go.

Copilot AI requested a review from ashishb May 12, 2026 14:45
@ashishb ashishb merged commit 951dfd3 into main May 13, 2026
3 checks passed
@ashishb ashishb deleted the copilot/add-fallback-for-output-head-file branch May 13, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants