Skip to content

Fix 404 error when sharing link on Messenger - /en/ redirect issue#8

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-404-error-on-url-change
Draft

Fix 404 error when sharing link on Messenger - /en/ redirect issue#8
Copilot wants to merge 3 commits intomainfrom
copilot/fix-404-error-on-url-change

Conversation

Copy link
Contributor

Copilot AI commented Dec 13, 2025

Description

Messenger redirects https://netbr3ak.github.io/forge-page to /en/ causing 404. Social platforms infer language paths from hreflang without explicit og:locale.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Other (please describe):

Related Issues

N/A

Changes Made

  • Added og:locale meta tags: en_US for index.html, pl_PL for pl.html with reciprocal alternates
  • Fixed canonical URLs: pl.html now points to itself instead of root
  • Fixed og:url: pl.html now references correct URL
  • 404 redirect fallback: Auto-redirect /en and /en/ paths to root
<!-- index.html -->
<meta property="og:locale" content="en_US">
<meta property="og:locale:alternate" content="pl_PL">

<!-- pl.html -->
<link rel="canonical" href="https://netbr3ak.github.io/forge-page/pl.html" />
<meta property="og:url" content="https://netbr3ak.github.io/forge-page/pl.html">

<!-- 404.html -->
<script>
  (function() {
    const path = window.location.pathname;
    const basePath = '/forge-page/';
    if (path === basePath + 'en' || path === basePath + 'en/') {
      window.location.replace(basePath);
    }
  })();
</script>

Screenshots (if applicable)

N/A - Metadata changes only

Testing

  • I have tested this change locally
  • I have tested on multiple browsers (Chrome, Firefox, Safari)
  • I have tested on mobile devices/responsive views
  • All existing tests pass

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have checked for accessibility issues

Additional Notes

After deployment, clear Facebook cache via Sharing Debugger for immediate effect.

Original prompt

po wysłaniu linka na messengerze https://netbr3ak.github.io/forge-page po otwarciu zmienia się w https://netbr3ak.github.io/forge-page/en/ i jest 404 napraw to w pełni


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 13, 2025 20:48
Co-authored-by: NetBr3ak <85062086+NetBr3ak@users.noreply.github.com>
Co-authored-by: NetBr3ak <85062086+NetBr3ak@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix 404 error on URL change after sending link Fix 404 error when sharing link on Messenger - /en/ redirect issue Dec 13, 2025
Copilot AI requested a review from NetBr3ak December 13, 2025 20:52
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