feat: restore pinboard
This commit is contained in:
parent
2b675945ba
commit
ce1dce2ebd
6 changed files with 23 additions and 101 deletions
|
@ -1,5 +1,20 @@
|
|||
const links = require('../_data/json/links.json')
|
||||
const EleventyFetch = require('@11ty/eleventy-fetch')
|
||||
|
||||
module.exports = async function () {
|
||||
return links.links.reverse()
|
||||
const API_TOKEN_PINBOARD = process.env.API_TOKEN_PINBOARD
|
||||
const url = `https://api.pinboard.in/v1/posts/recent?auth_token=${API_TOKEN_PINBOARD}&format=json&tag=share&count=5`
|
||||
const res = EleventyFetch(url, {
|
||||
duration: '1h',
|
||||
type: 'json',
|
||||
}).catch()
|
||||
const links = await res
|
||||
return links['posts'].map((link) => {
|
||||
return {
|
||||
title: link['description'],
|
||||
url: link['href'],
|
||||
tags: [...new Set(link['tags'].split(' '))],
|
||||
date: link['time'],
|
||||
description: link['extended'],
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Reference in a new issue