Add aliases

This commit is contained in:
Sam Carlton 2022-04-27 13:19:25 -05:00
parent e72029d2de
commit e955cbd076
2 changed files with 18 additions and 0 deletions

View file

@ -5,6 +5,8 @@ import {
ListingDetails
} from '~/helpers/listing-page.js'
import Aliases from '~/src/components/listing/aliases.astro'
import AllUpdatesSubscribe from '~/components/all-updates-subscribe.vue'
@ -25,6 +27,8 @@ const details = new ListingDetails( listing )
{ details.subtitle }
</h2>
<Aliases listing={ listing } />
<AllUpdatesSubscribe

View file

@ -0,0 +1,14 @@
---
const {
listing
} = Astro.props
const hasMultipleAliases = Array.isArray( listing.aliases ) && listing.aliases.length > 1
const listFormatter = new Intl.ListFormat('en', { style: 'short', type: 'disjunction' });
---
{ hasMultipleAliases ?
<small class="text-xs opacity-75">May also be known as ${ listFormatter.format( listing.aliases, 'or' ) }</small>
: '' }