mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-06-17 06:09:30 -05:00
renamed urlTitle to slug since thats what it should be
This commit is contained in:
parent
affb7fc36a
commit
5eb80dff81
|
|
@ -30,7 +30,7 @@ const blogPostSchema = new mongoose.Schema({
|
|||
required: [true, 'Short version is required']
|
||||
},
|
||||
meta: {
|
||||
urlTitle: {
|
||||
slug: {
|
||||
type: String,
|
||||
required: [true, 'Author is required'],
|
||||
trim: true
|
||||
|
|
@ -73,17 +73,17 @@ blogPostSchema.methods.getBlogPostShortTemplateReady = function() {
|
|||
return {
|
||||
content: this.short,
|
||||
title: this.name,
|
||||
url: common.convertDateToString(this.meta.date) + '/' + this.meta.urlTitle
|
||||
url: common.convertDateToString(this.meta.date) + '/' + this.meta.slug
|
||||
};
|
||||
};
|
||||
|
||||
blogPostSchema.statics.convertMarkdownToHtml = function(markdown) {
|
||||
return converter.makeHtml(markdown);
|
||||
};
|
||||
blogPostSchema.statics.getPost = function(date, urlTitle, callback) {
|
||||
blogPostSchema.statics.getPost = function(date, slug, callback) {
|
||||
return blogPostModel.findOne({
|
||||
'meta.date': date,
|
||||
'meta.urlTitle': urlTitle
|
||||
'meta.slug': slug
|
||||
}, callback);
|
||||
};
|
||||
// not tested
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ router.post('/admin/api/v1/newpost', adminUserMiddleware.adminAuthenticationRequ
|
|||
meta: {
|
||||
author,
|
||||
category,
|
||||
urlTitle: title
|
||||
slug: title
|
||||
.trim()
|
||||
.replace(/\s/g, '-')
|
||||
.replace(/[^A-z0-9-]/g, '')
|
||||
|
|
@ -226,7 +226,7 @@ router.post('/admin/api/v1/newpost', adminUserMiddleware.adminAuthenticationRequ
|
|||
newBlogPost.save().then((post) => {
|
||||
// successfull
|
||||
common.sendApiReturn(res, {
|
||||
url: common.convertDateToString(post.meta.date) + '/' + post.meta.urlTitle
|
||||
url: common.convertDateToString(post.meta.date) + '/' + post.meta.slug
|
||||
});
|
||||
}).catch((rejection) => {
|
||||
// TODO format exception so it doesnt have a huge list of errors
|
||||
|
|
@ -269,7 +269,7 @@ router.post('/admin/api/v1/editpost', adminUserMiddleware.adminAuthenticationReq
|
|||
}, (err, post) => {
|
||||
if (err) return common.sendApiError(res, 500, [err]);
|
||||
common.sendApiReturn(res, {
|
||||
url: common.convertDateToString(post.meta.date) + '/' + post.meta.urlTitle
|
||||
url: common.convertDateToString(post.meta.date) + '/' + post.meta.slug
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user