mirror of
https://github.com/romancm/gamebrary
synced 2024-11-10 05:34:15 +00:00
Use linkify in game news
This commit is contained in:
parent
b6a4db641c
commit
5e257aba56
4 changed files with 16 additions and 2 deletions
|
@ -30,6 +30,8 @@
|
|||
"firebase-admin": "^9.2.0",
|
||||
"firebase-functions": "^3.11.0",
|
||||
"firebaseui": "^4.8.0",
|
||||
"linkify-html": "^4.0.2",
|
||||
"linkifyjs": "^4.0.2",
|
||||
"lodash.chunk": "^4.2.0",
|
||||
"lodash.groupby": "^4.6.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<!-- TODO: use linkify https://github.com/Hypercontext/linkifyjs / http://localhost:4000/g/144072/hot-wheels-unleashed/news -->
|
||||
<!-- TODO: find out all possible news sources and add constant entries -->
|
||||
<!-- TODO: make game cover sticky -->
|
||||
<template lang="html">
|
||||
|
|
|
@ -4,6 +4,8 @@ import slugify from 'slugify'
|
|||
import bbobHTML from '@bbob/html'
|
||||
import presetHTML5 from '@bbob/preset-html5'
|
||||
import orderby from 'lodash.orderby';
|
||||
import * as linkify from 'linkifyjs';
|
||||
import linkifyHtml from 'linkify-html';
|
||||
|
||||
export default {
|
||||
latestRelease: ({ releases }) => releases?.[0]?.tag_name || 'v1',
|
||||
|
@ -47,6 +49,7 @@ export default {
|
|||
});
|
||||
|
||||
const contents = article?.contents?.replaceAll('{STEAM_CLAN_IMAGE}', 'https://cdn.akamai.steamstatic.com/steamcommunity/public/images/clans/');
|
||||
const formattedContent = linkifyHtml(contents, { defaultProtocol: 'https', target: '_blank' });
|
||||
|
||||
return {
|
||||
title: article.title,
|
||||
|
@ -54,7 +57,7 @@ export default {
|
|||
url: article.url,
|
||||
author: article?.author || null,
|
||||
date: new Date(article.date * 1000).toLocaleDateString("en-US", { dateStyle: 'short' }),
|
||||
contents: bbobHTML(contents, presetHTML5()),
|
||||
contents: bbobHTML(formattedContent, presetHTML5()),
|
||||
source: NEWS_SOURCES?.[feedSlug] || `MISING: ${article?.feedname} | ${feedSlug}`,
|
||||
tags: article.tags,
|
||||
};
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -7373,6 +7373,16 @@ lines-and-columns@^1.1.6:
|
|||
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
|
||||
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
|
||||
|
||||
linkify-html@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/linkify-html/-/linkify-html-4.0.2.tgz#f55e58ee27b4e34793f03a0bf81910c8a92151e5"
|
||||
integrity sha512-YcN3tsyutK2Y/uSuoG0zne8FQdoqzrAgNU5ko0DWE7M2oQ3ms4z/202f2W4TvRm9uxKdrsWAullfynANLaVMqw==
|
||||
|
||||
linkifyjs@^4.0.2:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/linkifyjs/-/linkifyjs-4.0.2.tgz#5844ea70f4427004e50036d983b66da50fe13389"
|
||||
integrity sha512-/VSoCZiglX0VMsXmL5PN3lRg45M86lrD9PskdkA2abWaTKap1bIcJ11LS4EE55bcUl9ZOR4eZ792UtQ9E/5xLA==
|
||||
|
||||
listr2@^3.8.3:
|
||||
version "3.14.0"
|
||||
resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.14.0.tgz#23101cc62e1375fd5836b248276d1d2b51fdbe9e"
|
||||
|
|
Loading…
Reference in a new issue