Refactor duplicated code: extract reusable partials and helpers - #241
Draft
gurusabarish with Copilot wants to merge 3 commits into
Draft
Refactor duplicated code: extract reusable partials and helpers#241gurusabarish with Copilot wants to merge 3 commits into
gurusabarish with Copilot wants to merge 3 commits into
Conversation
…ation Co-authored-by: gurusabarish <53465361+gurusabarish@users.noreply.github.com>
Co-authored-by: gurusabarish <53465361+gurusabarish@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor duplicated code for better maintainability
Refactor duplicated code: extract reusable partials and helpers
Nov 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eliminated code duplication across template files by extracting repeated patterns into reusable partials.
Changes
Social network icons - Extracted 5 SVG definitions (GitHub, LinkedIn, Twitter, Instagram, Facebook) from inline markup into
layouts/partials/socialIcons/socialNetwork.htmlfrom 95 to 37 linesCard components - Created reusable partials for repeated card markup:
layouts/partials/cards/project.html- Used in 3 locations (projects section, projects list, content pages)layouts/partials/cards/blogPost.html- Used in 2 locations (blog list, recent posts footer)Achievement cards - Collapsed URL/non-URL variants into single conditional structure
ID sanitization - Extracted
replaceREregex pattern intolayouts/partials/helpers/sanitizeId.htmlExample
Before:
After:
{{- partial "cards/project.html" . -}}Impact: Net -32 lines, improved consistency across theme.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
publish.twitter.comIf you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.