How to setup google doc to Wordpress post

I’ve made a Scenario setup like this, Google drive (watch a specific folder) > Google Doc (Get Content of a Document) > Wordpress (Create a Post). It worked but a few things I gotta try to figure out.

  1. How to get it to post the html of the google doc (h2, h3), for the wordpress content area

  2. How do I create an area for the Excerpt from a google doc?

  3. How do I create an area for the Slug from the google doc (sometimes it can be different from the title)?

  4. How do I make it so that if I make changes to the google doc, it will update the wp post.

Hey Tony, good questions!

The Get Content of a Document module returns an array of “Structural Elements” named Content, which can be paragraphs, section breaks, tables or ToC entries. You’d need to iterate through this array and pick out the Structural Elements that apply - probably only paragraph elements.

You’d then want to map the Paragraph Style for that Structural Element to the corresponding HTML tag. For that, you could use a mapping table in a Data Store.

It’s going to be quite a bit of work … mainly because Google Docs isn’t really an HTML editor.

If you don’t have to stick with Google Docs, it would be much better (and simpler) to use a real HTML editor to create your source document.

1 Like

surely there’s an easier way to just parse the text to html when it feeds it into wordpress. Google doc is easier to handle since I’m sharing that folder with a bunch of writers.

i tried also doing what you mention but all I’m getting on the wordpress end is shortcodes in the content area of the post.

Unfortunately you can’t just parse the text to html - each Structural Element is stored separately, and each Paragraph Style is held as a separate collection. It’s not held inline, so you can’t just parse it.

It’s a feature of how the Google Docs API works - Make just presents it in the same way.

One alternative would be to use the Google Drive Download a File module. Using the Advanced Settings on that module you can make it download the file in HTML format - which you could then simply upload to WordPress.

But that file might have a lot of extra HTML tags in it - you can get a sense of what’s produced by accessing your file in a browser as https://docs.google.com/document/d/<DOCID>/export?format=html

2 Likes

I forgot to mention that I managed to do this through Chat GPT and it worked but it stopped after a certain amount of text. I wonder why that keeps happening? Is there a limitation on the amount of text?

this seems (https://www.make.com/en/help/app/markdown) to be able to do cleaning of the html but I can’t quite figure out how to use it with google doc to wordpress.