How to list all Draft Posts?

Hi,

I’m migrating a site with over 500 posts. I ran the WP-to-Hugo migrator which got me about 70% of the way.

With the .md now converted, I am going through each post 1 by 1 and fixing the remaining 30%. This includes things that the migrator wordpress plugin got wrong, or could not process / convert.

As I do this, I am marking the posts as draft: true and running hugo build locally to --buildDrafts.

In this context, I would like to know the following
1, Once I am done migrating all the posts, how do I list the ones that are set as drafts in the command line
2. Is it possible to undraft them as a batch / using wildcards in title or date etc?

I am aware that I can set draft=false 1 by 1.

Thank you!

Look at the where function in the doc. You can filter by draft status.

Thanks @bep

I was unable to locate where in the documentation site. Didn’t find it in the command line help either. Is it a command line switch or something in unix / bash (Windows guy here :stuck_out_tongue_closed_eyes:)

Digging through the docs, I finally found the list command, which is what I think I am looking for.

hugo list drafts

Source: https://gohugo.io/commands/hugo_list_drafts/

I was delighted to see on the documentation page, that I can also list future posts.

hugo list future

Great job guys!!

No, there are no command for that. I meant the where tempate func:

Thanks. Good to know. I was looking more from a command line perspective, to filter out the drafts.

Looks like the list command does it in command line, and the where template function exposes the same inside the templating engine.

OK, I was wrong, there is:

hugo list drafts
Usage:
  hugo list [command]

Available Commands:
  drafts      List all drafts
  future      List all posts dated in the future

See http://gohugo.io/commands/hugo_list/