diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-13 15:31:19 +0100 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-13 15:39:07 +0100 |
| commit | 52411f6cb9efc10dd683096b34e5c279a11f7e0a (patch) | |
| tree | fd5e71902fbebe2e3f014c7ebb5f153fc8c7d1e7 /src/loaders/pleroma.ts | |
| parent | 26ffc44ee72522891b4fdacac15134dfcf9c4859 (diff) | |
Rework how tags are working and make them native
Diffstat (limited to 'src/loaders/pleroma.ts')
| -rw-r--r-- | src/loaders/pleroma.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/loaders/pleroma.ts b/src/loaders/pleroma.ts index 975f57e..c57a22b 100644 --- a/src/loaders/pleroma.ts +++ b/src/loaders/pleroma.ts @@ -552,14 +552,14 @@ function replaceHashtagsWithLinks(content: string): { // First, replace existing markdown hashtag links: [#tag](any-url) let modifiedContent = content.replace(/\[#(\w+)\]\([^)]+\)/g, (_match, tag) => { tags.push(tag.toLowerCase()); - return `[#${tag}](/micro/tags/${tag.toLowerCase()})`; + return `[#${tag}](/tags/${tag.toLowerCase()})`; }); // Then, replace plain #hashtags (not already in markdown link format) // Negative lookbehind to avoid matching hashtags already in [#tag] format modifiedContent = modifiedContent.replace(/(?<!\[)#(\w+)(?!\])/g, (_match, tag) => { tags.push(tag.toLowerCase()); - return `[#${tag}](/micro/tags/${tag.toLowerCase()})`; + return `[#${tag}](/tags/${tag.toLowerCase()})`; }); return { @@ -699,7 +699,7 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { const { content: contentWithTags, tags: extractedTags } = replaceHashtagsWithLinks( merged.content, ); - tags = extractedTags; + tags = [...extractedTags, "micro"]; cleanedContent = replacePleromaLinks(contentWithTags, instanceUrl, allPostIds); attachments = merged.attachments; postId = status.id; @@ -709,7 +709,7 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { const rawContent = cleanContent(content); const { content: contentWithTags, tags: extractedTags } = replaceHashtagsWithLinks(rawContent); - tags = extractedTags; + tags = [...extractedTags, "micro"]; cleanedContent = replacePleromaLinks(contentWithTags, instanceUrl, allPostIds); postId = status.id; sourceUrl = status.url; |
