diff --git a/docs/css/custom.css b/docs/css/custom.css index 4464feea..db66d4eb 100644 --- a/docs/css/custom.css +++ b/docs/css/custom.css @@ -158,7 +158,7 @@ body { } .md-typeset h1 { - margin: 0 0 1rem; + margin: 0 0 0.5rem; font-size: 24px; line-height: 34px; } @@ -649,3 +649,73 @@ div.path { [hidden] { display: none !important; } + +.page-actions { + display: none; + gap: 0; + margin: 12px 0 2rem 0; + padding-bottom: 6px; + border-bottom: 1px solid var(--ibexa-snow); +} + +.md-typeset .page-action-btn { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 4px 12px; + background: transparent; + border: none; + text-decoration: none; + color: var(--ibexa-dusk-black); + font-size: 13px; + font-weight: 500; + cursor: pointer; + transition: color 0.15s ease; + white-space: nowrap; + position: relative; +} + +.page-action-btn+.page-action-btn::before { + content: ''; + position: absolute; + left: 0; + top: 50%; + transform: translateY(-50%); + height: 16px; + width: 1px; + background: var(--ibexa-snow); +} + +.page-action-btn svg { + width: 14px; + height: 14px; + fill: currentColor; + flex-shrink: 0; +} + +.page-action-btn.external::after, +.page-action-btn[rel="nofollow"]::after { + display: none; +} + +@media (max-width: 768px) { + .page-actions { + gap: 0; + } +} + +.page-actions--visible { + display: flex; +} + +.page-action-btn.page-action-btn--success { + background: #d4edda; + border-color: #c3e6cb; + color: #155724; +} + +.page-action-btn.page-action-btn--info { + background: color-mix(in srgb, var(--turquoise-pearl) 25%, white); + border-color: color-mix(in srgb, var(--turquoise-pearl) 40%, white); + color: var(--sherpa-blue); +} diff --git a/docs/css/navigation.css b/docs/css/navigation.css index e8eaaad9..00c38f04 100644 --- a/docs/css/navigation.css +++ b/docs/css/navigation.css @@ -392,7 +392,7 @@ .md-typeset ul.breadcrumbs { margin-left: 0; margin-top: 0; - padding-bottom: 2rem; + padding-bottom: 0.5rem; } ul.breadcrumbs li.breadcrumb-item { diff --git a/docs/personalization/configure_models.md b/docs/personalization/configure_models.md index 60a09c93..89bb7fb2 100644 --- a/docs/personalization/configure_models.md +++ b/docs/personalization/configure_models.md @@ -1,5 +1,6 @@ --- description: Configure models by setting up a timeframe, segments and other settings that define which content items are recommended. +exclude_from_llmstxt: true --- # Configure models diff --git a/docs/personalization/configure_personalization.md b/docs/personalization/configure_personalization.md index b57cff1c..5cd0d4c0 100644 --- a/docs/personalization/configure_personalization.md +++ b/docs/personalization/configure_personalization.md @@ -1,5 +1,6 @@ --- description: Configure your Personalization service by setting up models and scenarios which define which content items are recommended. +exclude_from_llmstxt: true --- # Configure personalization diff --git a/docs/personalization/configure_scenarios.md b/docs/personalization/configure_scenarios.md index 75f42c8d..6a5fd3b0 100644 --- a/docs/personalization/configure_scenarios.md +++ b/docs/personalization/configure_scenarios.md @@ -1,5 +1,6 @@ --- description: Configure models by setting up a timeframe, segments and other settings that define which content items are recommended. +exclude_from_llmstxt: true --- # Configure scenarios diff --git a/docs/personalization/content_import.md b/docs/personalization/content_import.md index ab707cd7..84b0a223 100644 --- a/docs/personalization/content_import.md +++ b/docs/personalization/content_import.md @@ -1,5 +1,6 @@ --- description: Importing existing data enables the Personalization service to provide better results for recommendations. +exclude_from_llmstxt: true --- # Import source data diff --git a/docs/personalization/content_types.md b/docs/personalization/content_types.md index 6f2f045c..f42e44ea 100644 --- a/docs/personalization/content_types.md +++ b/docs/personalization/content_types.md @@ -1,5 +1,6 @@ --- description: Types of content in the Personalization service allow building different recommendations for different parts of our content model. +exclude_from_llmstxt: true --- # Types of content diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index dd15a483..d385c25c 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -1,5 +1,6 @@ --- description: Enabling the Personalization service requires an installation key provided by Ibexa. +exclude_from_llmstxt: true --- # Enable personalization diff --git a/docs/personalization/event_types.md b/docs/personalization/event_types.md index 90315f0f..3089e086 100644 --- a/docs/personalization/event_types.md +++ b/docs/personalization/event_types.md @@ -1,5 +1,6 @@ --- description: Recommendations rely on tracking different events that describe users' behavior on the website. +exclude_from_llmstxt: true --- # Events diff --git a/docs/personalization/filters.md b/docs/personalization/filters.md index d97584b1..9d81abf7 100644 --- a/docs/personalization/filters.md +++ b/docs/personalization/filters.md @@ -1,5 +1,6 @@ --- description: Filters enable you to fine-tune recommendation results by eliminating, demoting, or promoting specific results. +exclude_from_llmstxt: true --- # Filters diff --git a/docs/personalization/integrate_scenario_results.md b/docs/personalization/integrate_scenario_results.md index c0402271..f8592761 100644 --- a/docs/personalization/integrate_scenario_results.md +++ b/docs/personalization/integrate_scenario_results.md @@ -1,6 +1,7 @@ --- description: Use the Personalized block to display recommendation results in your pages. edition: experience +exclude_from_llmstxt: true --- # Integrate scenario results diff --git a/docs/personalization/personalization.md b/docs/personalization/personalization.md index 7e93f7f7..4b360a90 100644 --- a/docs/personalization/personalization.md +++ b/docs/personalization/personalization.md @@ -1,5 +1,6 @@ --- description: Use the Personalization service to get recommendation for users based on their behavior and on the scenarios you configure. +exclude_from_llmstxt: true --- # Personalization diff --git a/docs/personalization/preview_scenario_results.md b/docs/personalization/preview_scenario_results.md index a4236e8a..f3667399 100644 --- a/docs/personalization/preview_scenario_results.md +++ b/docs/personalization/preview_scenario_results.md @@ -1,5 +1,6 @@ --- description: In the back office you can preview what results are recommended by the Personalization service. +exclude_from_llmstxt: true --- # Preview scenario results diff --git a/docs/personalization/recommendation_models.md b/docs/personalization/recommendation_models.md index 420f52aa..c46779d6 100644 --- a/docs/personalization/recommendation_models.md +++ b/docs/personalization/recommendation_models.md @@ -1,6 +1,7 @@ --- description: Models are building blocks to recommendation scenarios. They let you define which criteria to take into account when calculating recommendations. month_change: false +exclude_from_llmstxt: true --- # Recommendation models diff --git a/docs/personalization/review_perso_performance.md b/docs/personalization/review_perso_performance.md index ba489519..e378ab20 100644 --- a/docs/personalization/review_perso_performance.md +++ b/docs/personalization/review_perso_performance.md @@ -1,5 +1,6 @@ --- description: You can view the performance and statistical information about the Personalization service in the Personalization dashboard. +exclude_from_llmstxt: true --- # Review performance diff --git a/docs/personalization/scenarios.md b/docs/personalization/scenarios.md index 46a3be41..d91ba4ba 100644 --- a/docs/personalization/scenarios.md +++ b/docs/personalization/scenarios.md @@ -1,5 +1,6 @@ --- description: Scenarios define which recommendation results should be given in different situations. +exclude_from_llmstxt: true --- # Scenarios diff --git a/docs/personalization/segment_management.md b/docs/personalization/segment_management.md index 31fbfdbc..d71f565f 100644 --- a/docs/personalization/segment_management.md +++ b/docs/personalization/segment_management.md @@ -1,5 +1,6 @@ --- description: Manage segments and combine segment groups to get personalized content targeted at your clients. +exclude_from_llmstxt: true --- # Segment management @@ -199,4 +200,4 @@ or } ] } - ``` \ No newline at end of file + ``` diff --git a/docs/personalization/triggers.md b/docs/personalization/triggers.md index f9b76735..de41885d 100644 --- a/docs/personalization/triggers.md +++ b/docs/personalization/triggers.md @@ -1,5 +1,6 @@ --- description: Triggers enable sending recommendations as push messages to customers. +exclude_from_llmstxt: true --- # Triggers diff --git a/docs/personalization/use_cases.md b/docs/personalization/use_cases.md index d811f8b1..0cf764f7 100644 --- a/docs/personalization/use_cases.md +++ b/docs/personalization/use_cases.md @@ -1,5 +1,6 @@ --- description: The Personalization service can be used for content publishing and for ecommerce, taking into account both shop-related and content-related user behaviors. +exclude_from_llmstxt: true --- # Use cases diff --git a/hooks.py b/hooks.py new file mode 100644 index 00000000..a88502fb --- /dev/null +++ b/hooks.py @@ -0,0 +1,5 @@ +"""MkDocs hooks entry point — delegates to the installable llms_txt package.""" + +from llms_txt.hooks import on_config, on_page_content + +__all__ = ["on_config", "on_page_content"] diff --git a/llmstxt_preprocess.py b/llmstxt_preprocess.py new file mode 100644 index 00000000..e4d5b126 --- /dev/null +++ b/llmstxt_preprocess.py @@ -0,0 +1,5 @@ +"""mkdocs-llmstxt ``preprocess:`` entry point — delegates to the installable llms_txt package.""" + +from llms_txt.llmstxt_preprocess import preprocess + +__all__ = ["preprocess"] diff --git a/mkdocs.yml b/mkdocs.yml index b7050d56..4620a3e4 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -242,6 +242,9 @@ markdown_extensions: - pymdownx.highlight: guess_lang: false linenums: true + # Emit language-* classes so the Markdown conversion (llmstxt) can + # restore the language on fenced code blocks. + pygments_lang_class: true extend_pygments_lang: - name: php lang: php @@ -257,3 +260,6 @@ markdown_extensions: custom_checkbox: true - pymdownx.tilde - pymdownx.details + +hooks: + - hooks.py diff --git a/plugins.yml b/plugins.yml index 77a27471..3e76ae52 100644 --- a/plugins.yml +++ b/plugins.yml @@ -65,3 +65,13 @@ plugins: 'pim/work_with_product_categories.md': 'product_catalog/work_with_product_categories.md' 'pim/work_with_product_page_urls.md': 'product_catalog/work_with_product_page_urls.md' 'pim/work_with_product_variants.md': 'product_catalog/work_with_product_variants.md' + + - llmstxt: + preprocess: llmstxt_preprocess.py + + autoclean: false + full_output: llms-full.txt + sections: + # Built automatically when running MkDocs build based on MkDocs nav configuration, don't change + Ibexa User Documentation: + - index.md diff --git a/requirements.txt b/requirements.txt index c271f196..74485eb1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,5 @@ mkdocs-macros-plugin==1.3.7 mkdocs-redirects==1.2.2 mkdocs-autolinks-plugin==0.7.1 Jinja2==3.1.6 +mkdocs-llmstxt +ibexa-llms-txt @ git+https://github.com/ibexa/documentation-developer.git@5.0 diff --git a/theme/assets/page-actions.js b/theme/assets/page-actions.js new file mode 100644 index 00000000..ea34914d --- /dev/null +++ b/theme/assets/page-actions.js @@ -0,0 +1,55 @@ +/** + * Page Actions JavaScript + * Handles functionality for page action buttons (Copy as Markdown, View as Markdown, Edit on GitHub) + */ + +async function copyPageForLLM() { + const mdPath = document.querySelector('meta[name="markdown-path"]').content; + + try { + const response = await fetch(mdPath); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + const markdownContent = await response.text(); + await navigator.clipboard.writeText(markdownContent); + showButtonFeedback('success', 'Copied!'); + } catch (error) { + console.error('Failed to copy content:', error); + window.open(mdPath, '_blank'); + showButtonFeedback('info', 'Opened in tab'); + } +} + +function showButtonFeedback(type, message) { + const button = document.querySelector('button[onclick="copyPageForLLM()"]'); + if (!button) return; + + const originalHTML = button.innerHTML; + button.innerHTML = `${message}`; + + if (type === 'success') { + button.classList.add('page-action-btn--success'); + } else if (type === 'info') { + button.classList.add('page-action-btn--info'); + } + + setTimeout(() => { + button.innerHTML = originalHTML; + button.classList.remove('page-action-btn--success', 'page-action-btn--info'); + }, 2000); +} + +document.addEventListener('DOMContentLoaded', function() { + const pageActions = document.getElementById('page-actions'); + const firstH1 = document.querySelector('.bootstrap-iso h1, h1'); + + if (pageActions && firstH1) { + // If h1 is inside a special header container (e.g. release-notes-header), + // insert page-actions after that container so it doesn't disrupt the header layout. + const headerContainer = firstH1.closest('.release-notes-header'); + const anchor = headerContainer || firstH1; + anchor.insertAdjacentElement('afterend', pageActions); + pageActions.classList.add('page-actions--visible'); + } +}); diff --git a/theme/main.html b/theme/main.html index 731ebb26..bdbda737 100644 --- a/theme/main.html +++ b/theme/main.html @@ -9,6 +9,25 @@ {%- endif -%} {% endblock %} + {% block extrahead %} + {% if config.repo_url and page.edit_url %} + + + {% endif %} + + + + + + {% if page and not page.meta.exclude_from_llmstxt %} + {% set md_href = page.file.dest_uri | replace('.html', '.md') %} + + {% endif %} + + + + {% endblock %} + {% block site_nav %} {% if nav %} {% endif %} - {{ page.content }} +
+ {{ page.content }} + + + {% if config.repo_url and page.edit_url and not page.is_homepage and not page.meta.exclude_from_llmstxt %} +
+ + + + + + + View as Markdown + + + + + + View on GitHub + +
+ {% endif %} +
+ {% include "partials/tags.html" %} {% endblock %} diff --git a/theme/partials/header.html b/theme/partials/header.html index ba5ca093..80a43452 100644 --- a/theme/partials/header.html +++ b/theme/partials/header.html @@ -20,10 +20,5 @@ {% include ".icons/material/magnify.svg" %} {% include "partials/search.html" %} - {% if config.repo_url %} -
- {% include "partials/source.html" %} -
- {% endif %} diff --git a/theme/partials/source.html b/theme/partials/source.html deleted file mode 100644 index 76e885dc..00000000 --- a/theme/partials/source.html +++ /dev/null @@ -1,7 +0,0 @@ -{% import "partials/language.html" as lang with context %} - -
- {% include ".icons/fontawesome/brands/github-alt.svg" %} -
- View on GitHub -