Documentation and output for custom post types

This commit is contained in:
Will Boyd
2020-12-27 14:05:48 -05:00
parent d6ef25b764
commit 828230dedd
4 changed files with 12 additions and 4 deletions
+9 -1
View File
@@ -153,7 +153,15 @@ Whether or not to download and save images attached to posts. Generally speaking
- Type: `boolean`
- Default: `true`
Whether or not to download and save images scraped from <img> tags in post body content. Images are saved into `/images`. The <img> tags are updated to point to where the images are saved.
Whether or not to download and save images scraped from `<img>` tags in post body content. Images are saved into `/images`. The `<img>` tags are updated to point to where the images are saved.
### Include custom post types and pages?
- Argument: `--include-other-types`
- Type: `boolean`
- Default: `false`
Some WordPress sites make use of a `"page"` post type and/or custom post types. Set this to `true` to include these post types in the results. Posts will be organized into post type folders.
## Advanced Settings
+1 -1
View File
@@ -35,7 +35,7 @@ function getItemTypes(data, config) {
// effectively this will be 'post', 'page', and custom post types
const types = data.rss.channel[0].item
.map(item => item.post_type[0])
.filter(type => !['attachment', 'revision', 'nav_menu_item'].includes(type));
.filter(type => !['attachment', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset'].includes(type));
return [...new Set(types)]; // remove duplicates
} else {
// just plain old vanilla "post" posts
+1 -1
View File
@@ -66,7 +66,7 @@ function getPostContent(post, turndownService, config) {
if (config.saveScrapedImages) {
// writeImageFile() will save all content images to a relative /images
// folder so update references in post content to match
// folder so update references in post content to match
content = content.replace(/(<img[^>]*src=").*?([^/"]+\.(?:gif|jpe?g|png))("[^>]*>)/gi, '$1images/$2$3');
}
+1 -1
View File
@@ -45,7 +45,7 @@ async function writeMarkdownFilesPromise(posts, config ) {
// package up posts into payloads
const payloads = posts.map((post, index) => ({
item: post,
name: post.meta.slug,
name: (config.includeOtherTypes ? post.meta.type + ' - ' : '') + post.meta.slug,
destinationPath: getPostPath(post, config),
delay: index * settings.markdown_file_write_delay
}));