update tagging in cms
- tags are now on global config and not per-list - tags are now stored in a regular array rather than key-value object - tags can be fetched externally or embedded in the global config
This commit is contained in:
parent
9ce4e38301
commit
8267ab8e82
6 changed files with 45 additions and 53 deletions
2
libs/types/src/config/globals.d.ts
vendored
2
libs/types/src/config/globals.d.ts
vendored
|
@ -1,4 +1,5 @@
|
|||
import type { HeaderEntry } from './navigation'
|
||||
import type { MediaEntryTag } from '../content/entryTag'
|
||||
import type { RouteCollection } from './routing'
|
||||
import type { SiteThemeList } from './themes'
|
||||
import type { WarningModal } from './warnings'
|
||||
|
@ -12,5 +13,6 @@ export type SiteGlobals = {
|
|||
id: string
|
||||
stylesheetUrls: string[]
|
||||
themes: SiteThemeList
|
||||
tags?: string | MediaEntryTag[]
|
||||
warning: WarningModal
|
||||
}
|
||||
|
|
20
libs/types/src/content/entryTag.d.ts
vendored
20
libs/types/src/content/entryTag.d.ts
vendored
|
@ -2,7 +2,11 @@
|
|||
* Defines a tag used by entries in a gallery-list/article-list,
|
||||
* used for filtering entries from view
|
||||
*/
|
||||
export type EntryTag = {
|
||||
export type MediaEntryTag = {
|
||||
/**
|
||||
* specifies the id for the tag
|
||||
*/
|
||||
tagId: string
|
||||
/**
|
||||
* specifies a category that the tag belongs to
|
||||
* in order to optionally organize them in the view;
|
||||
|
@ -11,19 +15,13 @@ export type EntryTag = {
|
|||
* placed before any other sections formed by categories (if any)
|
||||
*/
|
||||
category?: string
|
||||
/**
|
||||
* can be used to describe a tag when hovering over it in the UI
|
||||
*/
|
||||
description?: string
|
||||
/**
|
||||
* specifies the name that the tag will appear as in the DOM;
|
||||
* if not specified, the id of the tag will be used in its place
|
||||
*/
|
||||
displayName?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the list of tags in a gallery-list/article-list,
|
||||
* a key-value object where the value is the entry,
|
||||
* and the key represents the id of a tag;
|
||||
* the id of a tag must be unique,
|
||||
* and the ids specified in a gallery/article entry must match
|
||||
* the ids specified in `EntryTagCollection` in order for them to work effectively
|
||||
*/
|
||||
export type EntryTagCollection = { [id: string]: EntryTag }
|
||||
|
|
17
libs/types/src/content/templates/shared.d.ts
vendored
17
libs/types/src/content/templates/shared.d.ts
vendored
|
@ -1,5 +1,4 @@
|
|||
import type { DateRange } from '../dateRange'
|
||||
import type { EntryTagCollection } from '../entryTag'
|
||||
|
||||
/**
|
||||
* Defines entries that are already fetched or are embedded directly in the list.
|
||||
|
@ -40,22 +39,6 @@ export type ListWithEntries<T> = {
|
|||
*/
|
||||
export type ResolvedListEntries<T> = ListEntries<Promise<T>>
|
||||
|
||||
/**
|
||||
* Defines a list that supports tagging the entries
|
||||
*/
|
||||
export type ListWithTags<T> = {
|
||||
/**
|
||||
* the tags to use for filtering entries
|
||||
*/
|
||||
tags?: EntryTagCollection
|
||||
/**
|
||||
* whether or not tag filtering removes entries completely from view;
|
||||
* if false, they will apply a class selector instead
|
||||
* in order to manually style (CSS filtering/opacity/etc.)
|
||||
*/
|
||||
removeFromView?: boolean
|
||||
} & ListWithEntries<T>
|
||||
|
||||
/**
|
||||
* Defines a list that has warnings on its entries
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue