Authoring flow without titles

I have a question: I use Wordpress right now without giving titles to posts.

I want to move and I think I can deal with themes not working correctly by patching them in some way or another.

My question was what the envisioned authoring flow would be for me. I couldn’t really see it scanning the documentation.

Currently when I click new post, Wordpress will get the next largest ID and let me write something. Is there a way I could automate this without jumping through too many hoops?

Unless you’re using front end such as CloudCannon or Decap, and assuming you’re using a CI/CD workflow, the authoring process is:

  1. hugo new content content/posts/post-1.md (or hugo new content content/posts/post-1/index.md for a page bundle)
  2. Edit and save the file
  3. git add -A && git commit -m "Add some content" && git push

That means I’ll have to write some logic myself to determine the id or filename?

I don’t understand the question.

OK. Give that the filenames are numbers, the hugo new command needs to be passed a number that is sequentially increasing (or just unique). I think I can deal with that.

Why do the file names have to be numbers?

1 Like

They could be anything, but since they’re sequential numbers at the moment, it would make sense to go on.

Here is the code I use to write a new post:

#!/usr/bin/env python3
"""
Find the highest numeric folder name in content/posts and return the next available number.
"""

import os
from pathlib import Path

def find_next_available_number(posts_dir='content/posts'):
    """Find the highest numeric folder name and return next available."""
    posts_path = Path(posts_dir)

    if not posts_path.exists():
        print(f"Error: Directory {posts_dir} does not exist")
        return None

    numeric_folders = []

    # Get all directories in content/posts
    for item in posts_path.iterdir():
        if item.is_dir():
            try:
                # Try to convert folder name to integer
                number = int(item.name)
                numeric_folders.append(number)
            except ValueError:
                # Skip non-numeric folder names
                continue

    if not numeric_folders:
        print("No numeric folders found")
        return 1

    # Sort the numbers
    numeric_folders.sort()

    highest = numeric_folders[-1]
    next_number = highest + 1

    # print(f"Found {len(numeric_folders)} numeric folders")
    # print(f"Highest number: {highest}")
    print(f"{next_number}")

    return next_number


if __name__ == '__main__':
    find_next_available_number()

next_number := `uv run find_next_number.py`

_write title:
    echo "New path: content/posts/{{ title }}/index.md"
    hugo new content/posts/{{ title }}/index.md
    code content/posts/{{ title }}/index.md

write slug=next_number: (_write slug)

So I can type:

just write or just write something-about-pets

And it’ll find a new number and open it up in my editor.