Skip to content

Fix formatting issues and add HCaptcha integration - #14

Merged
Gitanuj993 merged 7 commits into
mainfrom
fix
Aug 22, 2026
Merged

Gitanuj993 merged 7 commits into
mainfrom
fix

Conversation

@Gitanuj993

Copy link
Copy Markdown
Owner

No description provided.

@Gitanuj993 Gitanuj993 added bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request labels Aug 22, 2026
@github-actions

Copy link
Copy Markdown

🤖 AI Code Review

As an expert software engineer, I've reviewed your codebase for a personal portfolio website. The project is a static site with a clear separation of concerns (HTML, CSS, JS), and uses Vercel for deployment.

Here's a detailed breakdown:


Bugs

  1. index.html Script Tag Error:

    • Description: In public/index.html, the very last <script> tag is incomplete: <script src=". This will cause a JavaScript parsing error in the browser, potentially preventing subsequent scripts from running or causing console errors.
    • Severity: Critical
    • Fix: Correct it to <script src="./assets/js/index.js"></script>.
  2. Incorrect Last Updated Date (index.html):

    • Description: The "Last Updated:" text in public/index.html shows "3rd July 2026", which is a future date. This should reflect the actual last update or be made dynamic.
    • Severity: Minor
    • Fix: Update to the current date or implement a JavaScript solution to display the current date.
  3. Empty Content Placeholders (index.html):

    • Description: The "C++ Projects" and "Python Projects" sections in public/index.html contain empty <ul> tags. This makes these sections appear incomplete or broken.
    • Severity: Minor
    • Fix: Populate these lists with actual project links or placeholder content, or comment out/remove the sections if they are not ready.
  4. Typographical Errors (index.html meta keywords):

    • Description: In public/index.html, the meta name="keywords" contains "Backend Developmrnt" (should be "Development") and "Anuj Tawar learning" (should be "Anuj Tanwar learning" for consistency).
    • Severity: Minor
    • Fix: Correct the typos.
  5. Incorrect JavaScript Includes (Multiple HTML files):

    • Description: public/about.html, public/editorial.html, public/contact.html, public/blogs.html, and public/projects.html all incorrectly include public/assets/js/about.js. Each page should include its own specific JavaScript file (e.g., editorial.js for editorial.html).
    • Severity: High (logical bug; currently masked because all *.js files are identical and empty, but would break if page-specific logic is added).
    • Fix: Update the <script src="..." tags in each HTML file to point to their corresponding, correctly named JavaScript file (e.g., assets/js/editorial.js).
  6. Missing Footer Includes (Some HTML files):

    • Description: public/projects.html and public/contact.html are missing the <script src="assets/js/footer.js"></script> tag, meaning the footer component will not be loaded on these pages.
    • Severity: Medium
    • Fix: Add <script src="assets/js/footer.js"></script> before the closing </body> tag in both files.
  7. CSS Variable Overrides (about.css and global.css):

    • Description: public/assets/css/about.css redefines several global CSS variables (e.g., --bg-color, --surface-color, --border-color, --secondary-text) within a new :root selector.
      • Some redefinitions are redundant (same value as global.css).
      • Others introduce inconsistencies (e.g., --secondary-text becomes yellow instead of #c9d1d9, --border-color becomes red instead of #30363d).
    • Impact: Since :root variables are global, if about.css is loaded after global.css (which is standard), these definitions will override the global.css values for the entire site, not just the "About" page. This creates significant, unintended styling changes across all pages.
    • Severity: High (critical for theme consistency).
    • Fix: Remove the :root block from about.css. If page-specific overrides are needed, apply them with higher specificity to elements within the "About" page, not globally.
  8. Hardcoded Future Year in Footer (footer.html):

    • Description: public/components/footer.html contains &copy; 2026 Anuj Tanwar. All rights reserved.. The year "2026" is a future year and should be updated to the current year or made dynamic.
    • Severity: Minor
    • Fix: Change "2026" to the current year (e.g., "2024") or use JavaScript to dynamically set the current year.
  9. Vercel Deployment Configuration (vercel.json):

    • Description: git.deploymentEnabled: false is set in vercel.json. If you intend for Vercel to automatically deploy new changes when you push to your Git repository, this setting will prevent it.
    • Severity: Medium (if unintended)
    • Fix: If automatic Git deployments are desired, change git.deploymentEnabled to true. If this is intentional (e.g., manual deployments), consider adding a comment to explain the decision.

Security Issues

  1. Web3Forms access_key Exposure (index.html):

    • Description: The Web3Forms access_key (49509339-1ae4-436d-bfaf-745a13591829) is directly embedded in public/index.html as a hidden input field. This key is publicly visible in the browser's source code.
    • Risk: Malicious actors can easily extract this key and use it to submit spam directly to your Web3Forms endpoint, bypassing your website's form and any client-side CAPTCHA you might have.
    • Severity: Medium-High
    • Recommendation:
      • Best Practice: For better security, especially if your website were to grow, use a serverless function (e.g., a Vercel Function) as an intermediary. Your frontend would send the form data to your serverless function, which then securely sends it to Web3Forms using the access_key stored as an environment variable (not exposed client-side).
      • Acceptable for Portfolio (with caveats): For a simple portfolio's contact form, Web3Forms' model assumes this level of exposure is acceptable with CAPTCHA and rate limiting on their end. However, it's still generally considered bad practice to expose API keys directly in client-side code. Ensure Web3Forms' spam protection (like hCaptcha and rate limits) is robust.
  2. hCaptcha Validation (Client-Side Only):

    • Description: While hCaptcha is integrated, the implementation relies solely on Web3Forms' client-side processing.
    • Risk: For robust spam prevention, especially in more complex applications, server-side validation of the hCaptcha token is crucial to confirm the legitimacy of the user. Without a custom backend, this is a limitation when relying solely on third-party form services.
    • Severity: Low (given reliance on Web3Forms, but important to note for general security awareness).
    • Recommendation: If a custom backend is ever introduced, ensure server-side validation of the hCaptcha token.

Performance Improvements

  1. Client-Side Component Loading (Navbar & Footer):

    • Description: The navbar.html and footer.html components are fetched and injected into the DOM using JavaScript (navbar.js, footer.js) after the page loads.
    • Impact:
      • FOUC (Flash Of Unstyled Content): Users might experience a brief "flicker" or delay where the page renders without the navbar/footer, then they suddenly appear.
      • SEO: While modern search engines can execute JavaScript, content present in the initial HTML is generally indexed more efficiently.
      • Increased Requests: Adds two extra HTTP requests per page load.
    • Recommendation: For a static site, consider using a build-time approach (e.g., a static site generator like Eleventy, Hugo, or even simple Node.js scripts) to "pre-include" these common components into your HTML files before deployment. This would eliminate the JavaScript fetching and ensure content is present on initial load.
  2. Redundant Empty JavaScript/CSS Files:

    • Description:
      • public/assets/js/about.js, editorial.js, contact.js, blogs.js, projects.js are all identical and contain only an empty initializeAboutPage() function.
      • public/assets/css/blogs.css, contact.css, editorial.css, projects.css are almost empty, containing only basic main and h1 styles that could easily be covered by global.css.
    • Impact: Each of these files results in an additional HTTP request, contributing to network overhead, even if they're small.
    • Recommendation: Remove these files if they truly offer no unique content or functionality. Consolidate their minimal styles into global.css if appropriate. Only include JavaScript files when specific interactivity is needed for that page.
  3. Font Loading Strategy:

    • Description: Google Fonts are loaded using <link rel="preconnect"> and <link> tags in index.html.
    • Impact: While preconnect is good, text might briefly appear in a default font before the custom fonts load (Flash Of Unstyled Text - FOUT).
    • Recommendation: Consider adding font-display: swap to your font stylesheet link (if supported, often via @import or direct URL in CSS) to allow the browser to render text immediately with a fallback font, then swap to the custom font once loaded. For optimal performance, self-hosting fonts can also reduce DNS lookups and initial connection times.
  4. Image Optimization:

    • Description: The banner image is loaded from an external service (capsule-render.vercel.app). Other potential images (e.g., logo/preview.jpg) are not explicitly optimized.
    • Recommendation: Ensure all locally hosted images are appropriately compressed and sized for web use. Consider using modern image formats like WebP or AVIF for better compression and quality where browser support allows.

Code Quality Suggestions

  1. Consistent CSS Variable Usage:

    • Description: public/assets/css/index.css hardcodes many color values (e.g., #0d1117, #58a6ff) instead of leveraging the CSS variables defined in global.css (e.g., var(--bg-color), var(--accent-color)).
    • Improvement: Using CSS variables consistently across all stylesheets (after fixing the about.css override bug) will greatly improve maintainability, making it easier to change the site's theme or color scheme from a single place.
  2. Remove Dead/Commented-Out Code:

    • Description:
      • index.js contains a large commented-out block of previous form submission logic.
      • public/components/navbar.html has commented-out "Projects" and "Contact" links.
      • public/index.html has a commented-out resume section.
      • public/assets/css/global.css has a large commented-out block of alternative main and nav styles.
    • Improvement: Remove all dead or commented-out code. Use Git history if you need to revert to previous versions. This cleans up the codebase and makes it easier to read and maintain.
  3. Complete README.md:

    • Description: Sections like "Badges & info", "Tech Stack Used", and "Project Structure" in README.md are marked with ?, indicating missing information. The "Features and Details" section is also minimal.
    • Improvement: Populate these sections with relevant details to provide a comprehensive overview of the project for contributors or visitors. Add badges for technologies or build status.
  4. Semantic HTML Improvements:

    • Description:
      • In public/index.html, the "AT" logo (.logo h1) and subsequent tagline (<p>Software Engineer | Problem Solver | Builder</p>) could be encapsulated in a more semantic <header> element within the page's main content.
      • The <span> Programming Languages </span> in index.html lacks the badge class, making it visually inconsistent with Python and C++.
    • Improvement: Use HTML elements that best describe the content they contain. Apply consistent styling classes where intended.
  5. Enhanced Form Error/Success Feedback:

    • Description: Currently, index.js uses alert() for submission failures. While a success message appears on the page, error feedback could be more integrated.
    • Improvement: Utilize the success-message element to display both success and error messages. Style error messages (e.g., red text) for clear user feedback, removing the intrusive alert() calls.
  6. Consistent Naming and Branding:

    • Description: The site uses both "AT" (in index.html's prominent logo) and "Anuj Tanwar" (in page titles, meta tags, and navbar logo).
    • Improvement: Ensure a consistent branding approach across the site. If "AT" is the primary brand for the logo, ensure all titles and references are consistent, or clearly distinguish between the brand and the full name where appropriate.
  7. CSS Styling Hierarchy and Overlap:

    • Description: Base body styles are defined in both global.css and index.css, creating an implicit override.
    • Improvement: Define foundational, site-wide styles in global.css. Page-specific CSS files (like index.css) should only contain styles that override or add to the global styles for that particular page, not redefine common elements.

Final Score (/10)

Overall Assessment:
The project provides a functional basic portfolio website with a good foundation for structure and modularity (using components). The choice of a static site with Vercel is suitable for a personal portfolio.

However, the codebase contains a significant number of basic bugs that would impact maintainability and user experience as the site grows. The most critical issues are the incorrect JavaScript includes across multiple pages, the global CSS variable override introduced by about.css, and the exposed API key for the contact form. These errors, while some might be minor individually, collectively indicate a lack of thorough testing and adherence to consistent development practices.

Score Breakdown:

  • Functionality: The site works at a basic level, but many placeholder sections and navigation issues (commented-out links) reduce its completeness.
  • Readability & Maintainability: Generally okay, but marred by dead code, inconsistent CSS variable usage, and bugs that would make future debugging difficult.
  • Best Practices: Lacking in areas like API key security, consistent CSS/JS management, and basic HTML correctness.

Based on the detailed review, considering the severity and quantity of issues:

Final Score: 4/10

To achieve a higher score, I recommend addressing all the identified bugs, especially the critical ones, improving security practices for API keys, and refining the code quality for better maintainability and performance.

@github-actions

Copy link
Copy Markdown

🤖 AI Code Review

As an expert software engineer, I've reviewed your codebase. It's a personal portfolio website built with HTML, CSS, and JavaScript, intended for deployment on Vercel.

Here's a breakdown of my findings:


Bugs

  1. Critical JavaScript Syntax Error in public/index.html:
    • The file ends with <script src= without a closing </script> tag. This is a critical syntax error that will prevent public/assets/js/index.js (and any other scripts following it) from executing. This means your contact form's submission logic will be entirely broken.
  2. Missing hCaptcha Script:
    • You have a <div class="h-captcha" data-captcha="true"></div> in public/index.html, but you haven't included the necessary hCaptcha script (e.g., <script src="https://js.hcaptcha.com/1/api.js" async defer></script>) to load the hCaptcha library. The captcha will not appear or function, making your form submission fail if hCaptcha is enforced.
  3. Missing Footer in public/projects.html:
    • public/projects.html loads navbar.js and projects.js, but it's missing the <script src="assets/js/footer.js"></script> tag that all other pages use to load the footer. This means the footer will be absent on the projects page.
  4. Inconsistent CSS Variables / Theming Conflict in public/assets/css/about.css:
    • public/assets/css/about.css redefines :root CSS variables (e.g., --bg-color, --surface-color, --secondary-text, --border-color) which are already defined in public/assets/css/global.css. Since about.css is loaded after global.css, these redefinitions will override the global variables specifically for the "About" page, leading to an inconsistent theme (e.g., light gray cards, yellow text, red borders for education timeline) that clashes with the rest of your dark-themed site. This is a major theming bug.
  5. Duplicate JavaScript Function Names:
    • Files like public/assets/js/about.js, editorial.js, contact.js, blogs.js, and projects.js all define and call a function named initializeAboutPage(). This is confusing and bad practice. While JavaScript allows this if they are in separate files and don't conflict globally (they're within DOMContentLoaded), it indicates copy-pasting and lack of specific logic for those pages.
  6. Rule_Set.md Irrelevance:
    • This markdown file appears to be a direct copy-paste from GitHub's documentation about repository rulesets. Its presence in a personal portfolio project's root directory is confusing and likely unintentional, or at least its purpose is undefined for this codebase.
  7. Incomplete README.md:
    • Sections like "Badges & info !", "Tech Stack Used ?", and "Project Structure ?" are marked with a ?, indicating missing information.
  8. Empty <ul> Elements in public/index.html:
    • The "C++ Projects" and "Python Projects" sections have empty <ul> tags. While not a functional bug, it represents missing content.
  9. Future "Last Updated" Date:
    • Last Updated: 3rd July 2026 in public/index.html is a date in the future, which is unprofessional and misleading.
  10. Malformed HTML Comment in public/index.html:
    • <! -- HCaptcha --> is missing the ! after < and before --. It should be <!-- HCaptcha -->.
  11. hCaptcha div Placement:
    • The <div class="h-captcha" data-captcha="true"></div> is placed outside the <form> tag. It should generally be nested within the form it's protecting.
  12. Conflicting Web3Forms Redirects:
    • You have both name="_next" and name="redirect" hidden inputs in your form. While Web3Forms typically handles this, one might override the other, or lead to unexpected redirect behavior. It's best to consult Web3Forms documentation and use only one if not both are explicitly supported for different purposes.

Security Issues

  1. Web3Forms access_key Exposure:
    • Your Web3Forms access_key (49509339-1ae4-436d-bfaf-745a13591829) is directly embedded in your public/index.html. While Web3Forms is designed to work this way for static sites, it means anyone can view your access_key in the browser's source code. A malicious actor could potentially use this key to send spam submissions to your form endpoint, potentially exhausting your free tier limits or causing other issues. For a simple contact form on a personal portfolio, this is a common and often accepted trade-off for simplicity, but it's a security consideration. For more sensitive applications, you'd typically proxy this request through a backend server.

Performance Improvements

  1. Dynamic Loading of Navbar and Footer HTML:
    • public/assets/js/navbar.js and public/assets/js/footer.js use fetch to load components/navbar.html and components/footer.html respectively. This introduces an extra network request and JavaScript execution delay for critical UI elements. This can lead to a Flash Of Unstyled Content (FOUC) or a visible delay where the header/footer is absent before being injected.
    • Improvement: For a static site, it's generally more performant to directly embed the navbar.html and footer.html content into each HTML file at build time (if using a build tool) or simply copy-paste them if the site is small and static. This eliminates extra network requests and allows the browser to render them immediately.
  2. CSS File Concatenation:
    • You are loading global.css and then index.css (and similarly for other pages). For a small static site, combining these into a single CSS file could reduce the number of HTTP requests, though the impact is minor with modern HTTP/2.
  3. Image Optimization:
    • Ensure all local images (e.g., public/logo/favicon.png, public/logo/preview.jpg) are optimized for web (compressed, appropriate dimensions, correct format like WebP where supported) to reduce file sizes and load times. The capsule-render banner is an external dependency, so its optimization is outside your control.

Code Quality Suggestions

  1. Semantic HTML:
    • Instead of a generic <div class="container"> for your main content and div class="card" for sections like "About Me," "Projects," etc., consider using more semantic HTML5 elements like <main> for the page's primary content and <section> for distinct content blocks. This improves accessibility and SEO.
  2. Metadata Consistency:
    • Ensure consistency between your <title> tag, og:title, and og:description. For example, your <title> is "AT | Anuj Tanwar | Portfolio" while og:title is "AT Portfolio | SWE-0".
  3. CSS Variable Usage & Consistency:
    • While you use CSS variables in global.css, index.css sometimes uses hardcoded values (e.g., #0d1117, #e6edf3) instead of var(--bg-color) or var(--text-color). Use variables consistently to make global theme changes easier.
    • The about.css variable conflict mentioned in "Bugs" is a major inconsistency and should be resolved by removing the duplicate :root definitions in about.css and using global.css's variables.
  4. DRY (Don't Repeat Yourself) CSS:
    • Many page-specific CSS files (blogs.css, contact.css, editorial.css, projects.css) contain almost identical styling for main, #<page_id>, and #<page_id> h1. These common styles should be moved to global.css or a common utility class.
  5. Remove Unused/Placeholder Files and Code:
    • public/logo/Images.md is empty. Remove it if not needed.
    • public/assets/data/*.json files are empty. If they are intended for dynamic content, they should at least contain an empty array [] or object {} to be valid JSON.
    • Remove commented-out HTML and CSS (<script src= in index.html, <!-- comments, commented-out CSS in global.css).
    • Remove the boilerplate initializeAboutPage() functions in JS files if they contain no specific logic for those pages.
  6. Better Content and Details:
    • Fill out all the empty sections (Projects, Blogs, Editorials, Contact pages) with meaningful content.
    • Provide more detail for the "Libraries & Modules" percentages in public/index.html. What do 3% or 1% represent? Skill level, usage frequency, contribution?
    • Clarify the purpose of Rule_Set.md or remove it.
  7. Consistent Styling:
    • In public/index.html under "Tech Stack", <span > Programming Languages </span> doesn't use the .badge class, making its styling inconsistent with the other tech stack items. Apply .badge or give it a distinct, intentional style.
  8. Relative vs. Absolute Paths in Navbar:
    • Links like href="index.html" in public/components/navbar.html are relative. For a static site, this usually works, but using absolute paths (e.g., href="/index.html") can make the site more robust if deployed under a subdirectory.

Final Score: 4/10

The codebase provides a basic structure for a portfolio website and demonstrates an understanding of fundamental web technologies. However, it suffers from several critical bugs (missing script tag, non-functional captcha, broken footer, major CSS theming inconsistency) that severely impact its functionality and user experience.

There's a significant amount of placeholder content and repetitive/boilerplate code, indicating incompleteness and a lack of attention to detail in some areas. Security and performance considerations are present but could be improved.

To achieve a higher score, the project needs:

  • Resolution of all critical bugs (especially the JS syntax error and hCaptcha).
  • Completion of all content sections.
  • A thorough refactor to improve code quality, reduce redundancy, and ensure consistent styling and variable usage.
  • Implementation of performance best practices for static assets.

@Gitanuj993
Gitanuj993 merged commit a4480dc into main Aug 22, 2026
2 checks passed
Gitanuj993 added a commit that referenced this pull request Aug 22, 2026
Merge pull request #14 from Gitanuj993/fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant