Skip to content

Commit 61fc3cc

Browse files
authored
Merge pull request #12 from CesarNog/codex/fix-testimonials-loading-issue
Fix testimonials on static site
2 parents 0073fd6 + ed63ed5 commit 61fc3cc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

index.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,21 +426,28 @@ <h3>Hear from People that Worked with me</h3>
426426
<div class="testimonial-slider__slide swiper-slide">
427427
<div id="linkedin-testimonials">Loading testimonials...</div>
428428
<script>
429-
const recommendationsApi = 'inc/linkedinProxy.php'
429+
// Replace with your LinkedIn profile URN and access token
430+
const accessToken = 'AQVreBjNPXJ1mmevakpZy6jwGW88Vt0OgH1dxj3xhaKRw4AU1xo3i-0qh-K4CUqLmZ7YkQAthxkgpWwe4DBYLVRSgdjmOcNyLO8GMA5QVotcQiJsDOWiXY4GPKCeqPKnUMjwC72o2fSz9k_DMQf_eTXR9ZoZ50fBM68DoXPphq7Wd2NayM1B2-Q8bwMYrprURt4jIe-XF8lRhGcZfOAK_qkdRwzfhahHcJ_hQkv2JZd6QOar8pbOKex-dUzqqohjLQ1cfZTcQM9s0H2P802AOd4Xqhx-svcxc8ynrZd7HH1q0PbFDAH3fXFuwAvpzqcq823L9_SyR3LNhjQUe8Fyn6zmtpJBFQ';
431+
const recommendationsApi = 'https://api.linkedin.com/v2/recommendations?q=received&start=0&count=5&projection=(elements*(recommendationText,recommender~(firstName,lastName,profilePicture(displayImage~:playableStreams))))';
430432

431433

432434
async function loadLinkedInTestimonials() {
433435
const container = document.getElementById('linkedin-testimonials')
434436
try {
435-
const response = await fetch(recommendationsApi)
437+
const response = await fetch(recommendationsApi, {
438+
headers: {
439+
'Authorization': `Bearer ${accessToken}`,
440+
'X-Restli-Protocol-Version': '2.0.0'
441+
}
442+
})
436443
if (!response.ok) throw new Error('Network response was not ok')
437444
const data = await response.json()
438445
const testimonials = data.elements || []
439446
if (testimonials.length === 0) throw new Error('No testimonials found')
440447
container.innerHTML = ''
441448
testimonials.forEach(t => {
442449
const text = t.recommendationText || ''
443-
const rec = t.recommender
450+
const rec = t.recommender || t['recommender~']
444451
const first = rec && rec.firstName ? (rec.firstName.localized ? Object.values(rec.firstName.localized)[0] : rec.firstName) : ''
445452
const last = rec && rec.lastName ? (rec.lastName.localized ? Object.values(rec.lastName.localized)[0] : rec.lastName) : ''
446453
const name = `${first} ${last}`.trim()

0 commit comments

Comments
 (0)