diff --git a/page/link.go b/page/link.go index c5f8b1d..c4ceab2 100644 --- a/page/link.go +++ b/page/link.go @@ -202,17 +202,27 @@ func parseLinks(markdown string) []markdownLink { return links } -// getConfluenceLink builds a stable Confluence tiny link for the given page. +// getConfluenceLink builds a stable Confluence tiny link for the given page or blog post. // Tiny links use the format {baseURL}/x/{encodedPageID} and are immune to // Cloud-specific URL variations like /ex/confluence//wiki/... func getConfluenceLink( api *confluence.API, space, title string, ) (string, error) { + // Try to find as a page first page, err := api.FindPage(space, title, "page") if err != nil { return "", karma.Format(err, "api: find page") } + + // If not found as a page, try to find as a blog post + if page == nil { + page, err = api.FindPage(space, title, "blogpost") + if err != nil { + return "", karma.Format(err, "api: find blogpost") + } + } + if page == nil { return "", nil }