rename blog -> article
This commit is contained in:
parent
96f6032b85
commit
7a0d229e67
10 changed files with 47 additions and 47 deletions
|
@ -5,20 +5,20 @@ import type {
|
|||
GalleryListDefinition,
|
||||
HeaderEntry,
|
||||
Link,
|
||||
BlogListDefinition,
|
||||
ArticleListDefinition,
|
||||
RouteDefinition,
|
||||
SiteGlobals,
|
||||
TemplateType,
|
||||
} from '@goldenwere/mackenzii-types'
|
||||
|
||||
const markdownBody = () => import ('./views/markdown/markdown.vue')
|
||||
const blogViewBody = () => import ('./views/blog/blog-view.vue')
|
||||
const articleViewBody = () => import ('./views/article/article-view.vue')
|
||||
const galleryViewBody = () => import ('./views/gallery/gallery-view.vue')
|
||||
const mediaListBody = () => import ('./views/shared/media-list.vue')
|
||||
|
||||
export const templates: Record<TemplateType, () => Promise<any>> = {
|
||||
'markdown': markdownBody,
|
||||
'blog-list': mediaListBody,
|
||||
'article-list': mediaListBody,
|
||||
'gallery-list': mediaListBody,
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,11 @@ export const createRoutes = (): RouteRecordRaw[] => {
|
|||
component: templates[routes[route].template],
|
||||
}
|
||||
|
||||
if (routes[route].template === 'blog-list') {
|
||||
if (routes[route].template === 'article-list') {
|
||||
routeRecord.push({
|
||||
name: `${routes[route].id}: View Blog`,
|
||||
name: `${routes[route].id}: View Article`,
|
||||
path: `${route}/view`,
|
||||
component: blogViewBody,
|
||||
component: articleViewBody,
|
||||
props: route => ({ id: route.query.id }),
|
||||
})
|
||||
} else if (routes[route].template === 'gallery-list') {
|
||||
|
@ -145,10 +145,10 @@ export const initializeRouteStore = (routerRoutes: readonly RouteRecordRaw[]) =>
|
|||
...routerRoutes.find(other => other.path === route) as RouteRecordRaw,
|
||||
...routes[route] as RouteDefinition,
|
||||
}
|
||||
if (routes[route].template === 'blog-list' || routes[route].template === 'gallery-list') {
|
||||
if (routes[route].template === 'article-list' || routes[route].template === 'gallery-list') {
|
||||
routeStore._routes[`${route}/view`] = {
|
||||
...routerRoutes.find(other => other.path === `${route}/view`) as RouteRecordRaw,
|
||||
...(routes[route] as BlogListDefinition | GalleryListDefinition).view,
|
||||
...(routes[route] as ArticleListDefinition | GalleryListDefinition).view,
|
||||
} as any
|
||||
}
|
||||
})
|
||||
|
|
|
@ -3,17 +3,17 @@ import { computed, onMounted, ref } from 'vue'
|
|||
import { marked } from 'marked'
|
||||
import { getFormattedDate } from 'src/utilities/parse'
|
||||
import type {
|
||||
BlogEntry,
|
||||
ArticleEntry,
|
||||
} from '@goldenwere/mackenzii-types'
|
||||
|
||||
const props = defineProps<{
|
||||
id: string,
|
||||
viewPath: string,
|
||||
isInternal: boolean,
|
||||
entry: Promise<BlogEntry>
|
||||
entry: Promise<ArticleEntry>
|
||||
}>()
|
||||
|
||||
const resolved = ref({} as BlogEntry)
|
||||
const resolved = ref({} as ArticleEntry)
|
||||
const thumbnail = computed(() => resolved.value.thumbnail)
|
||||
const description = computed(() => marked.parse(resolved.value.description || ''))
|
||||
const date = computed(() => !!resolved.value.date ? getFormattedDate(resolved.value.date) : null)
|
||||
|
@ -46,7 +46,7 @@ mixin embedText
|
|||
v-if='date'
|
||||
)
|
||||
span {{ date }}
|
||||
.blog-embed
|
||||
.article-embed
|
||||
.thumbnail-wrapper(
|
||||
v-if='!!thumbnail'
|
||||
)
|
|
@ -2,8 +2,8 @@
|
|||
import { onMounted, ref } from 'vue'
|
||||
import type {
|
||||
ListWithEntries,
|
||||
BlogEntry,
|
||||
BlogListDefinition,
|
||||
ArticleEntry,
|
||||
ArticleListDefinition,
|
||||
RoutedWindow,
|
||||
} from '@goldenwere/mackenzii-types'
|
||||
|
||||
|
@ -20,15 +20,15 @@ const emits = defineEmits<{
|
|||
}>()
|
||||
|
||||
const ready = ref(false)
|
||||
const resolved = ref({} as BlogEntry)
|
||||
const resolved = ref({} as ArticleEntry)
|
||||
const content = ref('')
|
||||
const currentRoute = getCurrentRoute()
|
||||
const routeStore = useRouteStore()
|
||||
const routeConfig = routeStore._routes[currentRoute.path.substring(0, currentRoute.path.length - 5)] as BlogListDefinition
|
||||
const routeConfig = routeStore._routes[currentRoute.path.substring(0, currentRoute.path.length - 5)] as ArticleListDefinition
|
||||
const routeSubConfig = routeStore._routes[currentRoute.path]
|
||||
|
||||
onMounted(async () => {
|
||||
const config = await fetchAndParseYaml<ListWithEntries<BlogEntry>>(routeConfig.config)
|
||||
const config = await fetchAndParseYaml<ListWithEntries<ArticleEntry>>(routeConfig.config)
|
||||
resolved.value = await fetchConfigByIdFromList(config, currentRoute.query.id as string)
|
||||
const md = await fetchAndParseMarkdown(resolved.value.url)
|
||||
content.value = md
|
||||
|
@ -44,7 +44,7 @@ onMounted(async () => {
|
|||
</script>
|
||||
|
||||
<template lang="pug">
|
||||
.template.blog-view
|
||||
.template.article-view
|
||||
Transition
|
||||
article(
|
||||
v-if='ready'
|
|
@ -12,7 +12,7 @@ import { useRouteStore } from 'src/routes'
|
|||
|
||||
import FilterPanel from 'src/components/shared/filter-panel.vue'
|
||||
import GalleryTile from '../gallery/gallery-tile.vue'
|
||||
import BlogTile from '../blog/blog-tile.vue'
|
||||
import ArticleTile from '../article/article-tile.vue'
|
||||
|
||||
type MediaList = ListWithTags<MediaEntry>
|
||||
|
||||
|
@ -46,9 +46,9 @@ const className = computed(() => {
|
|||
case 'gallery-list': {
|
||||
return 'gallery'
|
||||
}
|
||||
case 'blog-list':
|
||||
case 'article-list':
|
||||
default: {
|
||||
return 'blog'
|
||||
return 'article'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -135,8 +135,8 @@ onMounted(async () => {
|
|||
:isInternal='true'
|
||||
:entry='entry'
|
||||
)
|
||||
BlogTile(
|
||||
v-else-if='template === "blog-list" && (!entry.isHidden || !config.removeFromView)'
|
||||
ArticleTile(
|
||||
v-else-if='template === "article-list" && (!entry.isHidden || !config.removeFromView)'
|
||||
:class='{ hidden: entry.isHidden && !config.removeFromView }'
|
||||
:hideWarnings='hideWarnings'
|
||||
:id='id'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue