@factor/plugin-blog
Advanced tools
Comparing version 1.3.1 to 1.3.4
@@ -11,4 +11,4 @@ import { Component } from "vue" | ||
index: { | ||
title: "Fiction Essays - Building Apps, Code, Remote Work", | ||
description: "Fiction blog posts." | ||
title: "Blog", | ||
description: "The latest news and articles." | ||
} | ||
@@ -49,5 +49,7 @@ }, | ||
social: (): Promise<Component> => import("./widget-social.vue"), | ||
tags: (): Promise<Component> => import("./widget-tags.vue") | ||
tags: (): Promise<Component> => import("./widget-tags.vue"), | ||
notFound: (): Promise<Component> => import("./widget-not-found.vue"), | ||
loading: (): Promise<Component> => import("./widget-loading.vue") | ||
} | ||
} | ||
} |
39
index.ts
import { addPostType, addContentRoute } from "@factor/api" | ||
import { setting } from "@factor/api/settings" | ||
import { requestPostIndex } from "@factor/post/request" | ||
import { PostStatus } from "@factor/post/types" | ||
import { currentRoute } from "@factor/app/router" | ||
const baseRoute = setting("blog.postRoute") | ||
/** | ||
* Get post index and add to store | ||
*/ | ||
export const loadAndStoreBlogIndex = async (): Promise<void> => { | ||
const route = currentRoute() | ||
const { params, query } = route | ||
const tag = params.tag ?? query.tag ?? "" | ||
const category = params.category ?? query.category ?? "" | ||
const page = parseInt(params.page ?? query.page ?? 1) | ||
const limit = page === 1 ? setting("blog.limit") - 1 : setting("blog.limit") | ||
await requestPostIndex({ | ||
postType: "blog", | ||
tag, | ||
category, | ||
status: PostStatus.Published, | ||
sort: "-date", | ||
page, | ||
limit, | ||
conditions: { | ||
source: setting("package.name") | ||
} | ||
}) | ||
} | ||
/** | ||
* Sets admin and CMS | ||
*/ | ||
addPostType({ | ||
@@ -16,2 +47,5 @@ postType: "blog", | ||
/** | ||
* The front end routes | ||
*/ | ||
addContentRoute({ | ||
@@ -23,3 +57,4 @@ path: setting("blog.indexRoute") ?? "/", | ||
path: "/", | ||
component: setting("blog.components.blogIndex") | ||
component: setting("blog.components.blogIndex"), | ||
meta: { index: true } | ||
}, | ||
@@ -26,0 +61,0 @@ { |
{ | ||
"name": "@factor/plugin-blog", | ||
"description": "Easily implement, customize and manage blog in your Factor app.", | ||
"version": "1.3.1", | ||
"version": "1.3.4", | ||
"license": "GPL-2.0", | ||
@@ -19,3 +19,3 @@ "factor": { | ||
}, | ||
"gitHead": "c8a592af464da464cc61bb07e856a1b708b01849", | ||
"gitHead": "c62e1e0aac89e175d88f3a745540fc6b003656fc", | ||
"keywords": [ | ||
@@ -22,0 +22,0 @@ "factor", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
323143
26
111