Skip to content

Homepage AJAX quick-search, shared header/footer, and sitemap automation (SEO + UX improvements)#41

Open
m4tinbeigi-official wants to merge 6 commits intomainfrom
codex/optimize-project-and-remove-redundant-code-hjo9rh
Open

Homepage AJAX quick-search, shared header/footer, and sitemap automation (SEO + UX improvements)#41
m4tinbeigi-official wants to merge 6 commits intomainfrom
codex/optimize-project-and-remove-redundant-code-hjo9rh

Conversation

@m4tinbeigi-official
Copy link
Member

Motivation

  • Improve UX on the homepage by adding an inline AJAX search so users can discover results without navigating away, while keeping the Enter-key behavior to jump to the dedicated search page.
  • Make the site more crawlable so Google can index movies/series (AJAX content is not readily crawlable).
  • Provide an automated sitemap generator that enumerates static pages and (when available) dynamic TMDB movie/series URLs and expose a robots.txt that points to the sitemap.

Description

  • Added an AJAX quick-search UI to the homepage (index.html) and implemented client logic: createHomeSearchCard, runHomeAjaxSearch, and setupHomeSearch in script.js to fetch TMDB search results inline and keep Enter → /search/index.html?q=... behavior.
  • Added a crawlable on-page SEO section (#seo-crawl-links) on the homepage and a helper updateSeoCrawlLinks(...) to render indexable /movie/index.html?id=... and /series/index.html?id=... links populated after the main content fetch.
  • Made the dedicated search page auto-run when a q query parameter exists by adding getQueryParam('q') and auto-invoking the search (in search/search.js).
  • Introduced sitemap automation: scripts/generate-sitemap.mjs collects a set of static paths and attempts to enrich the sitemap with IDs from TMDB endpoints; it writes sitemap.xml using the base URL https://freemovieir.github.io. Added an npm script generate:sitemap in package.json.
  • Added robots.txt that allows crawlers and references the generated sitemap.
  • Centralized site chrome by adding js/layout-shared.js to render a shared header and footer into pages, and migrated many pages under pages/ (and added small redirect stubs) to keep canonical URLs consistent.
  • Improved poster resolution/OMDB poster fetching flow with resolvePoster(...), getCachedImage(...), and API-key switcher integration where available; used a proxied TMDB fetch helper proxify(...) to avoid CORS in the client.

Testing

  • Ran JavaScript static checks with node --check script.js, node --check search/search.js, and node --check scripts/generate-sitemap.mjs — all passed.
  • Executed npm run generate:sitemap in the environment; TMDB was unreachable in CI, but the generator gracefully fell back and produced a valid sitemap.xml containing the site domain https://freemovieir.github.io/ and the configured static paths (success with static fallback).
  • Started a local server (python -m http.server 4173) and captured a Playwright screenshot of the homepage AJAX search flow to validate the inline search UI (screenshot artifact created successfully).
  • Confirmed robots.txt and sitemap.xml files were added and contain the site domain reference for crawler discovery.

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

<a href="../movie/index.html?id=${id}" class="mt-2 bg-blue-500 text-white px-4 py-2 rounded">مشاهده جزئیات</a>

P2 Badge Route ID-search detail links to top-level movie/series pages

After moving this script under /pages/code/, the relative link ../movie/index.html (and the analogous TV link) now points to /pages/movie/index.html, but the actual detail routes are /movie/index.html and /series/index.html; users who click مشاهده جزئیات from ID-search results are sent to non-existent pages.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


<div id="shared-footer"></div>

<script src="../apiKeySwitcher.js"></script>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Point API key switcher script to the real root path

Because this page now lives at /pages/code/index.html, ../apiKeySwitcher.js resolves to /pages/apiKeySwitcher.js, but the repository only has /apiKeySwitcher.js; this leaves loadApiKeys undefined and initializeSwitcher() in pages/code/id-search.js throws on load, so the ID search workflow breaks as soon as the page initializes.

Useful? React with 👍 / 👎.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a60117f7fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

</button>
</div>
</header>
<div id="shared-header"></div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore theme toggle before player script initialization

player/index.html now swaps the static header for #shared-header, but the inline script still immediately executes document.getElementById('theme-toggle').addEventListener(...). Because the header is injected later by deferred /js/layout-shared.js, #theme-toggle is null on every page load, which throws and stops the remaining setup code (including paste auto-detect, keyboard shortcuts, and theme initialization).

Useful? React with 👍 / 👎.

</button>
</div>
</header>
<div id="shared-header"></div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep a UI trigger for returning to Playsho input mode

This header replacement removes the previous “film new” control that called showInputSection(), and after this change there is no remaining invocation in playsho/index.html (the function is only exported in playsho/script.js). In active sessions, users lose the in-page way to get back to the input form and start a new shared video without manually manipulating the URL/reloading.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant