Skip to content

Conversation

@GaneshPatil7517
Copy link
Contributor

@GaneshPatil7517 GaneshPatil7517 commented Jan 16, 2026

This PR implements automatic rendering of a WARNING section on documentation pages when the page metadata marks the component (or language, data format, misc) as deprecated.

When a documentation page includes the :deprecated: attribute in its AsciiDoc header, a prominent warning block will automatically appear at the top of the page (below the title), alerting users that the documented component/feature is deprecated.

Changes

Modified antora-ui-camel/src/partials/article.hbs to conditionally render a deprecation warning block:

  • Checks if the page has the deprecated attribute set
  • Renders an AsciiDoc-style WARNING admonition block with consistent styling
  • Uses the component's :shortname: if available, otherwise falls back to the page title
  • No manual changes required in individual AsciiDoc files
  • Applies to all documentation types: components, languages, data formats, misc

Implementation Details

The solution:

  1. Uses Handlebars' {{#unless}} block to check if the deprecated attribute is undefined
  2. Renders the warning using the existing admonition block styling (.admonitionblock.warning)
  3. Follows the Antora/AsciiDoc standard table structure for admonitions
  4. Leverages the {{or}} helper to display shortname or fallback to page title

Example

For a page with:

= My Component
:shortname: mycomponent
:deprecated: true

The rendered page will display:

┌──────────────────────────────────────────┐
│ ⚠️  Warning                               │
│ This mycomponent is deprecated            │
└──────────────────────────────────────────┘

Testing

Locally tested:

  • Built the Antora UI and website with the template changes
  • Verified that pages with :deprecated: true show the warning
  • Confirmed non-deprecated pages remain unchanged
  • CSS styling from existing admonition block styles is applied correctly

References

Closes #1477

Copilot AI review requested due to automatic review settings January 16, 2026 16:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic rendering of a deprecation warning at the top of documentation pages when the :deprecated: attribute is set in the page metadata.

Changes:

  • Modified the Handlebars template to conditionally display a WARNING admonition block when page.attributes.deprecated is defined
  • The warning displays the component's shortname (or page title as fallback) with a deprecation message

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

<tbody>
<tr>
<td class="icon">
<div class="title">Warning</div>
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icon structure doesn't match the expected AsciiDoc admonition format. According to the CSS in src/css/doc.css (lines 359-369), the icon should contain an <i> element with a title attribute. The CSS rule .doc .admonitionblock .icon i::after uses content: attr(title) to display the icon label. Replace <div class=\"title\">Warning</div> with <i title=\"Warning\"></i> to match the standard AsciiDoc admonition structure.

Suggested change
<div class="title">Warning</div>
<i title="Warning"></i>

Copilot uses AI. Check for mistakes.
<div class="title">Warning</div>
</td>
<td class="content">
This {{or page.attributes.shortname page.title}} is deprecated
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message uses raw page.title as fallback, which will include HTML markup since page.title can contain formatted text. This could result in HTML tags being displayed in the deprecation message. Consider using a plain text attribute or sanitizing the output to avoid displaying HTML markup in the warning message.

Suggested change
This {{or page.attributes.shortname page.title}} is deprecated
This {{or page.attributes.shortname 'page'}} is deprecated

Copilot uses AI. Check for mistakes.
{{#with page.title}}
<h1 class="page">{{{this}}}</h1>
{{/with}}
{{#unless (eq page.attributes.deprecated undefined)}}
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition checks if deprecated is NOT undefined, which means the warning will appear for any truthy value or even empty string. According to the issue #1477, the attribute should be explicitly checked for a truthy value. Consider using {{#if page.attributes.deprecated}} instead, which provides clearer intent and properly handles falsy values.

Copilot uses AI. Check for mistakes.
@GaneshPatil7517 GaneshPatil7517 force-pushed the warn-section-for-deprecated branch from 4793c53 to 5965e58 Compare January 17, 2026 03:45
@github-actions
Copy link
Contributor

🚀 Preview is available at https://pr-1479--camel.netlify.app

@GaneshPatil7517
Copy link
Contributor Author

hey @davsclaus exicted to see it merged...

@davsclaus
Copy link
Contributor

I do not see that deprecated warning such as
https://pr-1479--camel.netlify.app/components/4.14.x/nitrite-component.html

@davsclaus
Copy link
Contributor

this is wrong as it edits an article.hbs file which is not related to camel components. I think this should be done in camel-core/docs folder, where the components / languages et all are

Copy link
Contributor

@davsclaus davsclaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is wrong as it edits an article.hbs file which is not related to camel components. I think this should be done in camel-core/docs folder, where the components / languages et all are

@GaneshPatil7517
Copy link
Contributor Author

GaneshPatil7517 commented Jan 18, 2026

Hi @davsclaus,

Thanks for the review feedback! I've updated the implementation.

The issue was: The article.hbs template was checking for page.attributes.deprecated, but Antora only exposes document attributes with the page- prefix to templates. The component docs in camel-core use :deprecated: (without the prefix), so the attribute wasn't accessible.

The fix: I created an Antora extension (promote-deprecated-attribute.js) that promotes the document attributes to page attributes:

:deprecated: → page-deprecated
:supportlevel: → page-supportlevel
:shortname: → page-shortname
This way the template can access them via page.attributes.deprecated and display the warning banner. The extension is registered in antora-playbook.yml.

@GaneshPatil7517 GaneshPatil7517 force-pushed the warn-section-for-deprecated branch from 5965e58 to 429ddf6 Compare January 18, 2026 13:30
- Create Antora extension to promote 'deprecated', 'supportlevel', and 'shortname'
  document attributes to page attributes (page-deprecated, page-supportlevel,
  page-shortname) so they are accessible in Handlebars templates
- Update article.hbs template to display warning banner when page.attributes.deprecated
  is set, showing 'This {shortname} is deprecated' message
- Register the extension in antora-playbook.yml
@GaneshPatil7517 GaneshPatil7517 force-pushed the warn-section-for-deprecated branch from 429ddf6 to 5aa8475 Compare January 18, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add WARN section if a component is deprecated

3 participants