Skip to content

Refactor duplicated search markup into reusable template includes#634

Open
rajesh-puripanda wants to merge 2 commits intowagtail:mainfrom
rajesh-puripanda:template-cleanup
Open

Refactor duplicated search markup into reusable template includes#634
rajesh-puripanda wants to merge 2 commits intowagtail:mainfrom
rajesh-puripanda:template-cleanup

Conversation

@rajesh-puripanda
Copy link

While exploring the bakerydemo templates I noticed duplicated markup for the search form and search icon in header.html.

This PR extracts those sections into reusable template includes to reduce duplication and improve maintainability.

Changes

  • Extract search icon SVG into includes/search_icon_svg.html
  • Extract search form into includes/search_form.html
  • Replace duplicated markup in header.html with {% include %}

Result

  • Less duplicated markup
  • Easier to maintain search UI
  • No changes to layout or functionality

Verification

  • Ran python manage.py test
  • Manually verified the search form renders correctly in the header
  • Confirmed search functionality still works as expected

Happy to adjust the approach if there's a preferred template pattern for this.

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.

1 participant