Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
Límite de caracteres Js puro

¿Cómo puedo limitar el título de la publicación a 70 caracteres con el guión de la última publicación que uso en Blogger?

El título de la publicación a veces tiene más de 70 caracteres, lo que distorsiona la imagen.

 let postCount = 5; function funcrct(JSON) { const POSTS = JSON.feed.entry; let postTitle, postUrl = ""; let rpc = document.querySelector(".postList"); for (let i = 0; i < postCount; i++) { POSTS[i].link.forEach((el, i) => { if (el.rel === "alternate") { postTitle = el.title; if (postTitle.length >= 70) postTitle.subString(0,69) postUrl = el.href; } }) let thumbnail = POSTS[i].content.$t.match(/(http)?s?:?(\/\/[^"']*\.(?:webp))/)[0]; rpc.innerHTML += `<li> <a href="${postUrl}"><figure> <img src="${thumbnail}" alt="${postTitle}"/> <figcaption> ${postTitle}</figcaption></figure></a> </li>`; } } var url = document.location.origin; var fsrc = document.createElement("script"); fsrc.src = `${url}/feeds/posts/default?alt=json-in-script&start-index=1&max-results=${postCount}&callback=funcrct`; document.body.appendChild(fsrc);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

if (postTitle.length >= 70) postTitle.substring(0,69)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!