Quick overview
This workflow runs manually or every Monday at 9AM to analyze published WordPress posts with OpenAI embeddings, injects semantically relevant internal links using AI-selected anchor text, logs link updates to Notion, and posts Slack alerts for orphan pages and hub-page candidates.
How it works
- Runs on a manual trigger or on a weekly schedule (Mondays at 9AM).
- Retrieves all published posts from WordPress and extracts a clean title, excerpt, URL, and trimmed content for each post.
- Generates an OpenAI embedding for each post’s title and excerpt and computes cosine similarity to find the most related posts per article.
- For posts with strong matches, uses OpenAI to pick natural anchor text and a placement sentence from the source content for each suggested target.
- Injects the internal links into the WordPress post content and updates the post in WordPress.
- Logs the number of links added and orphan/hub signals to a Notion database, then sends Slack alerts for posts flagged as orphans or hub candidates.
Setup
- Add credentials for WordPress API, OpenAI API, Notion API, and Slack API.
- Update the Configuration values (brand name and WordPress site URL) to match your site.
- Set your Notion database ID in the Notion step and ensure the database has properties for Date, Post, Links Added, Is Orphan, Is Hub Candidate, and Client.
- Set the Slack channel ID used for orphan and hub candidate alerts.
- Test with a small set of posts or disable the WordPress update step if you want to review the generated links before writing changes to live content.