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;"
|
style="grid-area: meta;"
|
||||||
edited={post.post.updated}
|
edited={post.post.updated}
|
||||||
tags={tags?.tags}
|
tags={tags?.tags}
|
||||||
|
postUrl={post.post.url}
|
||||||
{view}
|
{view}
|
||||||
{extraBadges}
|
{extraBadges}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -98,6 +98,7 @@
|
|||||||
style?: string
|
style?: string
|
||||||
titleClass?: string
|
titleClass?: string
|
||||||
extraBadges?: import('svelte').Snippet
|
extraBadges?: import('svelte').Snippet
|
||||||
|
postUrl?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -122,6 +123,7 @@
|
|||||||
admin: false,
|
admin: false,
|
||||||
},
|
},
|
||||||
tags = [],
|
tags = [],
|
||||||
|
postUrl,
|
||||||
style = '',
|
style = '',
|
||||||
titleClass = '',
|
titleClass = '',
|
||||||
extraBadges,
|
extraBadges,
|
||||||
@@ -332,7 +334,12 @@
|
|||||||
</header>
|
</header>
|
||||||
{#if title && id}
|
{#if title && id}
|
||||||
<a
|
<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={[
|
class={[
|
||||||
'inline max-[480px]:mt-0!',
|
'inline max-[480px]:mt-0!',
|
||||||
'hover:underline hover:text-primary-900 dark:hover:text-primary-100 transition-colors',
|
'hover:underline hover:text-primary-900 dark:hover:text-primary-100 transition-colors',
|
||||||
|
|||||||
@@ -831,6 +831,10 @@
|
|||||||
"absoluteDates": {
|
"absoluteDates": {
|
||||||
"title": "Absolute timestamps",
|
"title": "Absolute timestamps",
|
||||||
"description": "Replaces relative timestamps (3 hours ago) with absolute ones (15/6/25)"
|
"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": {
|
"embeds": {
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ interface Settings {
|
|||||||
showHidden: boolean
|
showHidden: boolean
|
||||||
noVirtualize: boolean
|
noVirtualize: boolean
|
||||||
reverseActions: boolean
|
reverseActions: boolean
|
||||||
|
titleOpensUrl: boolean
|
||||||
}
|
}
|
||||||
infiniteScroll: boolean
|
infiniteScroll: boolean
|
||||||
language: string | null
|
language: string | null
|
||||||
@@ -172,6 +173,7 @@ export const defaultSettings: Settings = {
|
|||||||
showHidden: false,
|
showHidden: false,
|
||||||
noVirtualize: false,
|
noVirtualize: false,
|
||||||
reverseActions: toBool(env.PUBLIC_REVERSE_ACTIONS) ?? false,
|
reverseActions: toBool(env.PUBLIC_REVERSE_ACTIONS) ?? false,
|
||||||
|
titleOpensUrl: toBool(env.PUBLIC_TITLE_OPENS_URL) ?? false,
|
||||||
},
|
},
|
||||||
infiniteScroll: true,
|
infiniteScroll: true,
|
||||||
language: env.PUBLIC_LANGUAGE ?? null,
|
language: env.PUBLIC_LANGUAGE ?? null,
|
||||||
|
|||||||
@@ -439,6 +439,11 @@
|
|||||||
title={$t('settings.app.duplicateTitles.title')}
|
title={$t('settings.app.duplicateTitles.title')}
|
||||||
description={$t('settings.app.duplicateTitles.description')}
|
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
|
<ToggleSetting
|
||||||
title={$t('settings.app.titleTags.title')}
|
title={$t('settings.app.titleTags.title')}
|
||||||
description={$t('settings.app.titleTags.description')}
|
description={$t('settings.app.titleTags.description')}
|
||||||
|
|||||||
Reference in new issue
Block a user