Use local wiki_url in LINKS section when available

When wiki_url is present from the API (has_kiwix_wiki enabled with local
coverage), use it instead of building a wikipedia.org link. Shows article
name with (local) indicator consistent with the Read More link.

Also adds wikivoyage_url link when available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt 2026-04-29 19:02:55 +00:00
commit bc8db10101
2 changed files with 49 additions and 6 deletions

View file

@ -224,13 +224,13 @@ function EnrichmentSkeleton() {
function EnrichmentSections({ details }) {
if (!details) return null
const { category, extratags } = details
const { category, extratags, wiki_url, wikivoyage_url } = details
const et = extratags || {}
const hasAbout = category
const hasHours = et.opening_hours
const hasContact = et.phone || et.website || et.email
const hasDetails = et.cuisine || et.operator || et.fee || et.wheelchair || et.takeaway
const hasLinks = et.wikipedia || et.wikidata
const hasLinks = et.wikipedia || et.wikidata || wiki_url || wikivoyage_url
if (!hasAbout && !hasHours && !hasContact && !hasDetails && !hasLinks) return null
let idx = 0
return (
@ -264,7 +264,25 @@ function EnrichmentSections({ details }) {
{hasLinks && (
<DetailSection label="Links" icon={BookOpen} first={idx++ === 0}>
<div className="flex flex-col gap-1.5">
{et.wikipedia && wikiUrl(et.wikipedia) && <a href={wikiUrl(et.wikipedia)} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2 text-xs" style={{ color: "var(--accent)" }}><BookOpen size={13} style={{ color: "var(--text-tertiary)", flexShrink: 0 }} />{wikiLabel(et.wikipedia)}</a>}
{et.wikipedia && (wiki_url ? (
<a href={wiki_url} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2 text-xs" style={{ color: "var(--accent)" }}>
<BookOpen size={13} style={{ color: "var(--text-tertiary)", flexShrink: 0 }} />
<span>{wikiLabel(et.wikipedia)}</span>
<span style={{ color: "var(--text-tertiary)", fontSize: "9px" }}>(local)</span>
</a>
) : wikiUrl(et.wikipedia) && (
<a href={wikiUrl(et.wikipedia)} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2 text-xs" style={{ color: "var(--accent)" }}>
<BookOpen size={13} style={{ color: "var(--text-tertiary)", flexShrink: 0 }} />
{wikiLabel(et.wikipedia)}
</a>
))}
{wikivoyage_url && (
<a href={wikivoyage_url} target="_blank" rel="noopener noreferrer" className="flex items-center gap-2 text-xs" style={{ color: "var(--accent)" }}>
<Map size={13} style={{ color: "var(--text-tertiary)", flexShrink: 0 }} />
<span>Travel guide</span>
<span style={{ color: "var(--text-tertiary)", fontSize: "9px" }}>(local)</span>
</a>
)}
{et.wikidata && <a href={"https://www.wikidata.org/wiki/" + et.wikidata} target="_blank" rel="noopener noreferrer" className="text-[11px]" style={{ color: "var(--text-tertiary)", textDecoration: "underline" }}>View on Wikidata</a>}
</div>
</DetailSection>

View file

@ -253,14 +253,14 @@ function CopyPopover({ address, selectedPlace, onClose }) {
function EnrichmentSections({ details }) {
if (!details) return null
const { category, extratags } = details
const { category, extratags, wiki_url, wikivoyage_url } = details
const et = extratags || {}
const hasAbout = category
const hasHours = et.opening_hours
const hasContact = et.phone || et.website || et.email
const hasDetails = et.cuisine || et.operator || et.fee || et.wheelchair || et.takeaway
const hasLinks = et.wikipedia || et.wikidata
const hasLinks = et.wikipedia || et.wikidata || wiki_url || wikivoyage_url
if (!hasAbout && !hasHours && !hasContact && !hasDetails && !hasLinks) return null
@ -322,7 +322,19 @@ function EnrichmentSections({ details }) {
{hasLinks && (
<DetailSection label="Links" icon={BookOpen} first={idx++ === 0}>
<div className="flex flex-col gap-1.5">
{et.wikipedia && wikiUrl(et.wikipedia) && (
{et.wikipedia && (wiki_url ? (
<a
href={wiki_url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2 text-xs"
style={{ color: 'var(--accent)' }}
>
<BookOpen size={13} style={{ color: 'var(--text-tertiary)', flexShrink: 0 }} />
<span>{wikiLabel(et.wikipedia)}</span>
<span style={{ color: 'var(--text-tertiary)', fontSize: '9px' }}>(local)</span>
</a>
) : wikiUrl(et.wikipedia) && (
<a
href={wikiUrl(et.wikipedia)}
target="_blank"
@ -333,6 +345,19 @@ function EnrichmentSections({ details }) {
<BookOpen size={13} style={{ color: 'var(--text-tertiary)', flexShrink: 0 }} />
{wikiLabel(et.wikipedia)}
</a>
))}
{wikivoyage_url && (
<a
href={wikivoyage_url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center gap-2 text-xs"
style={{ color: 'var(--accent)' }}
>
<Map size={13} style={{ color: 'var(--text-tertiary)', flexShrink: 0 }} />
<span>Travel guide</span>
<span style={{ color: 'var(--text-tertiary)', fontSize: '9px' }}>(local)</span>
</a>
)}
{et.wikidata && (
<a