feat: add tags to shared content
This commit is contained in:
parent
64e434c6b9
commit
7216b848f4
8 changed files with 84 additions and 10 deletions
32
src/_data/json/tag-aliases.json
Normal file
32
src/_data/json/tag-aliases.json
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"tags": [
|
||||
{
|
||||
"tag": "Eleventy",
|
||||
"aliases": ["11ty", "eleventy"]
|
||||
},
|
||||
{
|
||||
"tag": "WebDev",
|
||||
"aliases": [
|
||||
"development",
|
||||
"javascript",
|
||||
"react",
|
||||
"nextjs",
|
||||
"gatsby",
|
||||
"vue",
|
||||
"svelte",
|
||||
"angular",
|
||||
"webdev",
|
||||
"web-development",
|
||||
"web-development"
|
||||
]
|
||||
},
|
||||
{
|
||||
"tag": "Tech",
|
||||
"aliases": ["technology", "tech"]
|
||||
},
|
||||
{
|
||||
"tag": "Music",
|
||||
"aliases": ["music"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -13,10 +13,6 @@ module.exports = async function () {
|
|||
const articles = feed.feed
|
||||
return articles.reverse().map((article) => {
|
||||
const tags = article['content']['tags'].map((tag) => tag['name'])
|
||||
const shareTags = tags
|
||||
.map((tag) => `#${tag}`)
|
||||
.join(' ')
|
||||
.trim()
|
||||
return {
|
||||
url: article['content']['url'],
|
||||
title: article['content']['title'],
|
||||
|
@ -24,9 +20,8 @@ module.exports = async function () {
|
|||
? new Date(article['content']['library']['modified_date'])
|
||||
: new Date(article['content']['publication_date']),
|
||||
description: article['content']['excerpt'],
|
||||
notes: article['content']['my_notes'],
|
||||
notes: article['content']['my_notes'] || '',
|
||||
tags,
|
||||
shareTags,
|
||||
id: btoa(article['id']),
|
||||
}
|
||||
})
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"items": [{% for entry in entries limit: 20 -%}
|
||||
{
|
||||
"id": "{{ entry.url | btoa }}",
|
||||
"title": "{{ entry.title | escape }}{% if share %}{{ entry.shareTags }}{%endif%}",
|
||||
"title": "{{ entry.title | escape }}{% if tagMap %} {{ entry.url | tagLookup: tagMap }}{% endif %}",
|
||||
"url": "{{ entry.url }}",
|
||||
"content_text": "{{ entry.title }} {{ entry.url }}",
|
||||
"date_published": "{{ entry.date | stringToDate | dateToRfc822 }}"
|
||||
|
|
|
@ -8,5 +8,5 @@ permalink: /feeds/share-follow.json
|
|||
data:follow.posts
|
||||
updated:follow.posts[0].date_published
|
||||
site:site
|
||||
share:true
|
||||
tagMap:collections.tagMap
|
||||
%}
|
|
@ -17,7 +17,6 @@ meta:
|
|||
image:
|
||||
src: https://coryd.dev/assets/img/avatar.webp
|
||||
---
|
||||
|
||||
{% for tag in collections.tagList %}
|
||||
<span>
|
||||
<a href="/tags/{{ tag }}" class="!no-underline">
|
||||
|
|
Reference in a new issue