Pelisgo’s movies feature is the core of the application, living onDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/LuisED18/proyecto-pagina-peliculas/llms.txt
Use this file to discover all available pages before exploring further.
index.html. When the page loads, it automatically calls the TMDB movie/popular endpoint to fetch a ranked list of currently popular movies, then renders each result as a visual card in a responsive grid. The entire flow — from API request to DOM insertion — is handled by a single shared main.js module.
The Movies Page
The movies page (index.html) is composed of three major structural sections:
- Sticky Header (
.head) — A fixed-position header that remains visible as you scroll. It holds the Pelisgo logo (linking back toindex.html) and the navigation bar. - Navigation Bar (
.barra) — A<nav>element containing an unordered list (.li-d) with links to Movies, Series, the Genres dropdown, and the live search input. - Main Content Grid (
.seccionPeliculas) — A<main>element that acts as the card container. It is pre-populated with 24 empty<div class="card">placeholders in the HTML; these are replaced entirely by JavaScript-generated cards once the API responds.
display: flex; flex-wrap: wrap; justify-content: center) with a max-width of 1200px and a gap of 20px between cards.
Fetching Popular Movies
When the page loads,main.js calls obtenerContenido() with no arguments. The function detects that no search query was provided and builds the popular movies endpoint URL using the tipo variable (which resolves to 'movie' on index.html).
datos.results array — containing up to 20 movie objects per page — is passed directly to mostrarCards().
Card Rendering
ThemostrarCards() function iterates over the results array, builds a <div class="card"> element for each item, and appends it to .seccionPeliculas. Before rendering, the function resolves both the title and year from the raw API fields, and provides a fallback image URL when poster_path is null.
| Element | Class | Content |
|---|---|---|
<img> | — | Poster image, or placeholder if poster_path is null |
<div> | .info | Container for title and year |
<h3> | .tituloPeli | Movie title in white, bold, 14px |
<span> | .fecha | 4-digit release year in #a1a1a1 grey |
poster_path is null, the fallback image used is:
TMDB Movie Object Fields
The following fields are consumed from each object in theresults array returned by TMDB:
| Field | Type | Usage |
|---|---|---|
item.title | string | The movie’s display title, rendered inside <h3 class="tituloPeli"> |
item.release_date | string | Full ISO date (e.g. "2024-07-19"); .split('-')[0] extracts the 4-digit year |
item.poster_path | string | null | Relative path appended to https://image.tmdb.org/t/p/w500 to form the full poster URL |
https://image.tmdb.org/t/p/w500/abc123.jpg