pawelsikora / mkdocs-with-confluence

MkDocs plugin for uploading markdown documentation to Confluence via Confluence REST API
MIT License
67 stars 33 forks source link

Unable to generate subpages #17

Open Acsigen opened 1 year ago

Acsigen commented 1 year ago

Prerequisites

Hi, I have generated a documentation with the structure presented in the image below:

image

When I try to uplopad the documentation to Confluence, only Home, Architecture, and Installation are getting published. Nothing under the Stacks subpage gets uploaded to Confluence as seen in the image below:

image

Config

This is my mkdocs.yml configuration file:

site_name: Monitoring
theme:
  name: windmill
plugins:
  - search
  - mkdocs-with-confluence:
          host_url: https://confluencebt.host/rest/api/content
          space: CONFLUENCE_SPACE
          parent_page_name: Monitorizare
          username: confluence_user
          password: confluence_password
          enabled_if_env: MKDOCS_TO_CONFLUENCE
          verbose: true
          debug: true
          dryrun: false
nav:
  - Home: "index.md"
  # - Introduction: "index.md"
  - Architecture: "architecture.md"
  - Installation: "installation.md"
  - Stacks:
    - Metrics: 
      - Architecture: "stacks/metrics/architecture.md"
      - Installation and Operation: "playbooks/metrics/README.md"
    - Logs:
      - Architecture: "stacks/logs/architecture.md"
      - Installation and Operation: "playbooks/logs/README.md"
    - Traces:
      - Architecture: "stacks/traces/architecture.md"
      - Installation and Operation: "playbooks/traces/README.md"

Log entry

INFO    -  Mkdocs With Confluence: Exporting MKDOCS pages to Confluence turned ON by var MKDOCS_TO_CONFLUENCE==1!
Number of Files in directory tree: 10
DEBUG    - SECTION title: Section(title='Stacks')
DEBUG    - SECTION title:     Section(title='Metrics')
DEBUG    - SECTION title:     Section(title='Logs')
DEBUG    - SECTION title:     Section(title='Traces')

DEBUG    - Handling Page 'Home' (And Parent Nav Pages if necessary):

DEBUG    - Get section first parent title...: 
DEBUG    - WRN(list index out of range): No first parent! Assuming DEBUG    - Monitorizare...
DEBUG    - None
DEBUG    - Get section second parent title...: 
DEBUG    - ERR(list index out of range) No second parent! Assuming second parent is main parent: Monitorizare...
Monitorizare
DEBUG    - ONLY ONE PARENT FOUND. ASSUMING AS A FIRST NODE after main parent config Monitorizare
DEBUG    - PARENT0: Monitorizare, PARENT1: Monitorizare, MAIN PARENT: Monitorizare

#################################################

INFO    -   * Mkdocs With Confluence: Find Page ID: PAGE NAME: Monitorizare
URL: https://confluencebt.host/rest/api/content?title=Monitorizare&spaceKey=CONFLUENCE_SPACE&expand=history
ID: 129549192
DEBUG    - JUST ONE STEP FROM UPDATE OF PAGE 'Monitorizare' 
DEBUG    - CHECKING IF PARENT PAGE ON CONFLUENCE IS THE SAME AS HERE
INFO    -   * Mkdocs With Confluence: Find PARENT OF PAGE, PAGE NAME: Monitorizare
INFO    -   * Mkdocs With Confluence: Find Page ID: PAGE NAME: Monitorizare
URL: https://confluencebt.host/rest/api/content?title=Monitorizare&spaceKey=CONFLUENCE_SPACE&expand=history
ID: 129549192
PARENT NAME: Documentation
DEBUG    - ERR, Parents does not match: 'Monitorizare' =/= 'Documentation' Aborting...

DEBUG    - Handling Page 'Installation and Operation' (And Parent Nav Pages if necessary):

DEBUG    - Get section first parent title...: 
DEBUG    - SECTION title: Section(title='Logs')
DEBUG    - Logs
DEBUG    - Get section second parent title...: 
DEBUG    - SECTION title: Section(title='Stacks')
Logs
DEBUG    - PARENT0: Logs, PARENT1: Stacks, MAIN PARENT: Monitorizare

Question

How can I change the configuration so the plugin will create the required subpages?

pawelsikora commented 1 year ago

So far as I remember two pages of the same name cannot exists in one space in confluence. (https://community.atlassian.com/t5/Confluence-questions/Two-pages-folders-with-the-same-name-within-one-space/qaq-p/1401009)

Could you give it a try and rename it in navigation names, not the file names?

Acsigen commented 1 year ago

I tried with the following mkdocs.yml structure:

nav:
  - Home: "index.md"
  # - Introduction: "index.md"
  - Architecture: "architecture.md"
  - Ansible Server Installation and Operation: "playbooks/ansible_server/README.md"
  - Metrics:
    - Metrics Architecture: "stacks/metrics/architecture.md"
    - Metrics Installation and Operation: "playbooks/metrics/README.md"
  - Logs:
    - Logs Architecture: "stacks/logs/architecture.md"
    - Logs Installation and Operation: "playbooks/logs/README.md"
  - Traces:
    - Traces Architecture: "stacks/traces/architecture.md"
    - Traces Installation and Operation: "playbooks/traces/README.md"

It seems that the error now is DEBUG - ERR, Parents does not match: 'Traces' =/= 'Monitorizare' Aborting....

For now I switched to a flat structure, but it would be great if a layered structure would be possible.