liang2kl / mkdocs-blogging-plugin

Add blogging feature to your MkDocs site.
https://liang2kl.github.io/mkdocs-blogging-plugin
MIT License
84 stars 17 forks source link

[BUG] Blog and Tags hyperlinks are set to repo_url instead of site_url when deploying on Gitlab Pages #59

Open Dodalpaga opened 2 weeks ago

Dodalpaga commented 2 weeks ago

Plugin version

v2.2.11

Python version

3.12.3

Additional environment information (optional)

Platform - GitLab Pages

What happened?

All the hyperlinks of blogs/tags redirects to the file in the repo_url (which is not public). Even when i remove the repo_url and repo_name from the mkdocs.yml file it doesn't work.

What should have happened? (optional)

No response

How to reproduce the bug?

Try deploying a mkdocs page with blogging plugin on gitlab.io pages from the repo

Additional context (optional)

I can't share much information about my use case here because of my company internal policy, but i am willing to help solve this problem. Feel free to contact me

Relevant log output (optional)

No response

liang2kl commented 1 week ago

Please give me an example of your mkdocs.yml file, which removes the private information. It is hard to reproduce the problem without it.

Dodalpaga commented 1 week ago

Sure, here it is :

---
# Project information
site_name: NAME
site_url: https://SITE_URL
site_author: AUTHORS

# Repository
repo_name: NAME
repo_url: https://REPO_URL

# Navigation layout
nav:
  - Home: 
    - index.md
    - Tags/allowed_tags.md
  - Bibliography: 
    - Bibliography/index.md
    - Articles:
      - Bibliography/Articles
    - PDF Files:
      - Bibliography/PDF Files
  - RetEx Projet:
    - RetEx Projet/index.md
    - Articles:
      - RetEx Projet/Articles
    - PDF Files:
      - RetEx Projet/PDF Files
  - RetEx Technique:
    - RetEx Technique/index.md
    - Articles:
      - RetEx Technique/Articles
    - Content: 
      - RetEx Technique/Content/index.md
      - Notebooks: 
        - RetEx Technique/Content/notebooks
      - PDF Files:
        - RetEx Technique/Content/PDF Files
      - Python:
        - RetEx Technique/Content/python
  - Global References: References/index.md
  - Tags: Tags/index.md

# Plugins
plugins:
  - search
  - include_dir_to_nav:
      sort_file: true
      sort_directory: true
      include_empty_dir: true
      # Modify the following line to allow other file extensions to appear in the navbar when selecting a whole folder
      file_pattern: '.*\.(md|py|ipynb)$'
  - pdf_titles
  - git-revision-date-localized
  - git-authors
  - blogging:
      size: 5
      locale: fr
      time_format: '%d/%m/%y %H:%M'
      meta_time_format: '%Y-%m-%d %H:%M'
      template: "./docs/stylesheets/custom-blog.html"
      # {{ blog_content }}
      dirs: # The directories to be included
        - Bibliography/Articles
        - RetEx Technique/Articles/
        - RetEx Projet/Articles/

      categories:
        # {{ blog_content Default }}
        - name: Default
          dirs:
            - Bibliography/Articles/
          size: 5

        # {{ blog_content Technique }}
        - name: Technique
          dirs:
            - RetEx Technique/Articles/
          size: 5

        # {{ blog_content Projet }}
        - name: Projet
          dirs:
            - RetEx Projet/Articles/
          size: 5
      features:
        tags:
          insert: top
  - with-pdf
  - mkdocs-jupyter
  - minify:
      minify_html: true

# Configuration
theme:
  name: material
  logo: images/logo.png
  favicon: images/logo.png
  palette:
    # Palette toggle for light mode
    - scheme: default
      toggle:
        icon: material/brightness-7 
        name: Switch to dark mode

    # Palette toggle for dark mode
    - scheme: slate
      toggle:
        icon: material/brightness-4
        name: Switch to light mode
  features:
    - search.suggest
    - navigation.path
    - navigation.indexes 
    - navigation.tracking
    - navigation.tabs
    - navigation.top
    - toc.follow
    - content.code.copy

# Customization
extra:
  consent:
    title: Cookie consent
    description: >- 
      We use cookies to recognize your repeated visits and preferences, as well
      as to measure the effectiveness of our documentation and whether users
      find what they're searching for. With your consent, you're helping us to
      make our documentation better.
  status:
    updated: Recently updated
  analytics:
    provider: google
    property: !ENV GOOGLE_ANALYTICS_KEY

# Extensions
markdown_extensions:
  - abbr
  - admonition
  - attr_list
  - def_list
  - footnotes
  - meta
  - md_in_html
  - toc:
      permalink: true
      title: On this page
  - pymdownx.arithmatex:
      generic: true
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.caret
  - pymdownx.details
  - pymdownx.highlight:
      anchor_linenums: true
  - pymdownx.inlinehilite
  - pymdownx.keys
  - pymdownx.magiclink:
      repo_url_shorthand: true
      user: squidfunk
      repo: mkdocs-material
  - pymdownx.mark
  - pymdownx.smartsymbols
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format
  - pymdownx.tabbed:
      alternate_style: true
  - pymdownx.tasklist:
      custom_checkbox: true
  - pymdownx.tilde
  - pymdownx.emoji:
      emoji_index: !!python/name:material.extensions.emoji.twemoji
      emoji_generator: !!python/name:material.extensions.emoji.to_svg

extra_css:
  - stylesheets/extra.css

I'm using a lot of other plugins so maybe the problem comes from a conflict with other plugins... Thanks !

Dodalpaga commented 1 week ago

[Update] It seems to work when i don't set the repo_url though