viernes 17 de julio de 2026

Mostrá las noticias de El Acontecer en tu sitio

Si administrás una página web, blog, portal institucional o medio local, ahora podés integrar automáticamente los últimos titulares de El Acontecer en tu sitio.

A través de un widget simple y liviano, vas a poder mostrar las noticias más recientes del diario, siempre actualizadas y con enlace directo a cada nota original.


¿Qué muestra este widget?

El widget de El Acontecer exhibe, en tiempo real:

  • los 5 titulares más recientes publicados en el diario
  • la fecha de cada noticia
  • un enlace directo a la nota completa en elacontecer.com.uy

Cada vez que se publica una noticia nueva, el contenido se actualiza automáticamente en tu sitio.


¿Para quién es útil?

Este widget es ideal para:

  • portales institucionales
  • radios y medios locales
  • clubes, organizaciones y asociaciones
  • blogs informativos o comunitarios
  • sitios web vinculados a la actualidad regional

Permite mantener un vínculo informativo activo con El Acontecer y ofrecer contenido actualizado a tus lectores.


Ventajas principales

  • No requiere registros ni configuraciones
  • No muestra publicidad
  • Es liviano y rápido
  • Compatible con cualquier plataforma
  • No consume recursos del sitio anfitrión

Funciona en WordPress, Blogger, Wix o cualquier sitio en HTML.


Cómo instalar el widget

  1. Copiá el código que aparece más abajo.
  2. Pegalo en el lugar de tu sitio donde quieras mostrar las noticias.

Según la plataforma:

  • WordPress: bloque HTML o widget de HTML personalizado
  • Blogger / Wix: módulo HTML
  • HTML puro: pegalo directamente en el código
  1. Guardá los cambios… y listo.

Código del widget (copiar y pegar)

<!-- WIDGET DE TITULARES DE EL ACONTECER -->
<div id="elacontecer-widget"></div>

<script>
(function() {
  const API_URL = "https://elacontecer.com.uy/wp-json/wp/v2/posts?per_page=5&_fields=link,title.rendered,date";

  function formatDate(dateStr) {
    const d = new Date(dateStr);
    return d.toLocaleDateString("es-UY", {
      day: "2-digit",
      month: "2-digit",
      year: "numeric"
    });
  }

  function createWidget(posts) {
    const container = document.getElementById("elacontecer-widget");
    if (!container) return;

    container.innerHTML = "";

    const wrapper = document.createElement("div");
    wrapper.style.border = "1px solid #ddd";
    wrapper.style.borderRadius = "8px";
    wrapper.style.padding = "12px";
    wrapper.style.fontFamily = "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif";
    wrapper.style.backgroundColor = "#ffffff";

    const header = document.createElement("div");
    header.style.display = "flex";
    header.style.justifyContent = "space-between";
    header.style.alignItems = "center";
    header.style.marginBottom = "8px";

    const title = document.createElement("div");
    title.textContent = "Últimas noticias de El Acontecer";
    title.style.fontWeight = "bold";
    title.style.fontSize = "14px";

    const link = document.createElement("a");
    link.href = "https://elacontecer.com.uy";
    link.textContent = "Ver más";
    link.target = "_blank";
    link.rel = "noopener noreferrer";
    link.style.fontSize = "12px";
    link.style.textDecoration = "none";
    link.style.color = "#0066cc";

    header.appendChild(title);
    header.appendChild(link);
    wrapper.appendChild(header);

    const list = document.createElement("ul");
    list.style.listStyle = "none";
    list.style.padding = "0";
    list.style.margin = "0";

    posts.forEach(function(post, index) {
      const item = document.createElement("li");
      item.style.marginBottom = "6px";
      if (index !== 0) {
        item.style.borderTop = "1px solid #eee";
        item.style.paddingTop = "6px";
      }

      const a = document.createElement("a");
      a.href = post.link;
      a.target = "_blank";
      a.rel = "noopener noreferrer";
      a.innerHTML = post.title.rendered;
      a.style.textDecoration = "none";
      a.style.color = "#333";
      a.style.fontSize = "13px";
      a.style.fontWeight = "500";
      a.setAttribute("aria-label", "Leer noticia: " + post.title.rendered);

      const date = document.createElement("div");
      date.textContent = formatDate(post.date);
      date.style.fontSize = "11px";
      date.style.color = "#777";

      item.appendChild(a);
      item.appendChild(date);
      list.appendChild(item);
    });

    const footer = document.createElement("div");
    footer.style.marginTop = "8px";
    footer.style.fontSize = "11px";
    footer.style.color = "#999";
    footer.innerHTML = 'Noticias provistas por <a href="https://elacontecer.com.uy" target="_blank" rel="noopener noreferrer">El Acontecer</a>';

    wrapper.appendChild(list);
    wrapper.appendChild(footer);
    container.appendChild(wrapper);
  }

  function showError() {
    const container = document.getElementById("elacontecer-widget");
    if (!container) return;
    container.innerHTML = "<small>No se pudieron cargar las noticias de El Acontecer.</small>";
  }

  fetch(API_URL)
    .then(response => {
      if (!response.ok) throw new Error("Error en la respuesta");
      return response.json();
    })
    .then(data => createWidget(data))
    .catch(error => {
      console.error("Error cargando el widget de El Acontecer:", error);
      showError();
    });

})();
</script>
<!-- FIN WIDGET DE EL ACONTECER -->