mirror of
https://github.com/10h30/wordpress-export-to-markdown.git
synced 2026-06-05 15:09:59 +09:00
Hardcode filter-categories and filter-post-types
This commit is contained in:
+3
-3
@@ -7,8 +7,8 @@ export function author(post) {
|
||||
return post.data.creator[0];
|
||||
}
|
||||
|
||||
// get array of decoded category names, filtered as specified in settings
|
||||
export function categories(post, config) {
|
||||
// get array of decoded category names, excluding 'uncategorized'
|
||||
export function categories(post) {
|
||||
if (!post.data.category) {
|
||||
return [];
|
||||
}
|
||||
@@ -17,7 +17,7 @@ export function categories(post, config) {
|
||||
.filter(category => category.$.domain === 'category')
|
||||
.map(({ $: attributes }) => decodeURIComponent(attributes.nicename));
|
||||
|
||||
return categories.filter((category) => !config.filterCategories.includes(category));
|
||||
return categories.filter((category) => category !== 'uncategorized');
|
||||
}
|
||||
|
||||
// get cover image filename, previously decoded and set on post.meta
|
||||
|
||||
+9
-2
@@ -1,7 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import xml2js from 'xml2js';
|
||||
import * as frontmatter from './frontmatter.js';
|
||||
import * as settings from './settings.js';
|
||||
import * as shared from './shared.js';
|
||||
import * as translator from './translator.js';
|
||||
|
||||
@@ -35,7 +34,15 @@ function getPostTypes(channelData) {
|
||||
// search export file for all post types minus some specific types we don't want
|
||||
const types = channelData
|
||||
.map(item => item.post_type[0])
|
||||
.filter(type => !settings.filter_post_types.includes(type));
|
||||
.filter(type => ![
|
||||
'attachment',
|
||||
'revision',
|
||||
'nav_menu_item',
|
||||
'custom_css',
|
||||
'customize_changeset',
|
||||
'wp_global_styles',
|
||||
'wp_navigation'
|
||||
].includes(type));
|
||||
return [...new Set(types)]; // remove duplicates
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -33,19 +33,19 @@ export const custom_date_timezone = 'utc';
|
||||
|
||||
// Categories to be excluded from post frontmatter. This does not filter out posts themselves,
|
||||
// just the categories listed in their frontmatter.
|
||||
export const filter_categories = ['uncategorized'];
|
||||
// export const filter_categories = ['uncategorized'];
|
||||
|
||||
// Strict SSL is enabled as the safe default when downloading images, but will not work with
|
||||
// self-signed servers. You can disable it if you're getting a "self-signed certificate" error.
|
||||
export const strict_ssl = true;
|
||||
// export const strict_ssl = true;
|
||||
|
||||
// Post types to exclude from output.
|
||||
export const filter_post_types = [
|
||||
'attachment',
|
||||
'revision',
|
||||
'nav_menu_item',
|
||||
'custom_css',
|
||||
'customize_changeset',
|
||||
'wp_global_styles',
|
||||
'wp_navigation'
|
||||
];
|
||||
// export const filter_post_types = [
|
||||
// 'attachment',
|
||||
// 'revision',
|
||||
// 'nav_menu_item',
|
||||
// 'custom_css',
|
||||
// 'customize_changeset',
|
||||
// 'wp_global_styles',
|
||||
// 'wp_navigation'
|
||||
// ];
|
||||
|
||||
Reference in New Issue
Block a user