feat: add option to make post titles open link, close #476
This commit is contained in:
5 files changed
+20
-1
No files matched your search
@@ -133,6 +133,7 @@
|
||||
style="grid-area: meta;"
|
||||
edited={post.post.updated}
|
||||
tags={tags?.tags}
|
||||
postUrl={post.post.url}
|
||||
{view}
|
||||
{extraBadges}
|
||||
/>
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
style?: string
|
||||
titleClass?: string
|
||||
extraBadges?: import('svelte').Snippet
|
||||
postUrl?: string
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -122,6 +123,7 @@
|
||||
admin: false,
|
||||
},
|
||||
tags = [],
|
||||
postUrl,
|
||||
style = '',
|
||||
titleClass = '',
|
||||
extraBadges,
|
||||
@@ -332,7 +334,12 @@
|
||||
</header>
|
||||
{#if title && id}
|
||||
<a
|
||||
href="/post/{encodeURIComponent(instance.data)}/{id}"
|
||||
href={settings.posts.titleOpensUrl && postUrl
|
||||
? postUrl
|
||||
: `/post/${encodeURIComponent(instance.data)}/${id}`}
|
||||
target={settings.posts.titleOpensUrl || settings.openLinksInNewTab
|
||||
? '_blank'
|
||||
: undefined}
|
||||
class={[
|
||||
'inline max-[480px]:mt-0!',
|
||||
'hover:underline hover:text-primary-900 dark:hover:text-primary-100 transition-colors',
|
||||
|
||||
@@ -831,6 +831,10 @@
|
||||
"absoluteDates": {
|
||||
"title": "Absolute timestamps",
|
||||
"description": "Replaces relative timestamps (3 hours ago) with absolute ones (15/6/25)"
|
||||
},
|
||||
"titleOpensUrl": {
|
||||
"title": "Title opens URL",
|
||||
"description": "Makes clicking the title open the post's attached URL, rather than the comments."
|
||||
}
|
||||
},
|
||||
"embeds": {
|
||||
|
||||
@@ -92,6 +92,7 @@ interface Settings {
|
||||
showHidden: boolean
|
||||
noVirtualize: boolean
|
||||
reverseActions: boolean
|
||||
titleOpensUrl: boolean
|
||||
}
|
||||
infiniteScroll: boolean
|
||||
language: string | null
|
||||
@@ -172,6 +173,7 @@ export const defaultSettings: Settings = {
|
||||
showHidden: false,
|
||||
noVirtualize: false,
|
||||
reverseActions: toBool(env.PUBLIC_REVERSE_ACTIONS) ?? false,
|
||||
titleOpensUrl: toBool(env.PUBLIC_TITLE_OPENS_URL) ?? false,
|
||||
},
|
||||
infiniteScroll: true,
|
||||
language: env.PUBLIC_LANGUAGE ?? null,
|
||||
|
||||
@@ -439,6 +439,11 @@
|
||||
title={$t('settings.app.duplicateTitles.title')}
|
||||
description={$t('settings.app.duplicateTitles.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
bind:checked={settings.posts.titleOpensUrl}
|
||||
title={$t('settings.app.titleOpensUrl.title')}
|
||||
description={$t('settings.app.titleOpensUrl.description')}
|
||||
/>
|
||||
<ToggleSetting
|
||||
title={$t('settings.app.titleTags.title')}
|
||||
description={$t('settings.app.titleTags.description')}
|
||||
|
||||
Reference in new issue
Block a user