Skip to content

Commit 1797e4a

Browse files
theletterfclaude
andauthored
Use UrlPathPrefix for agent-skill learn-more link (#2908)
* Fix agent-skill learn-more link to respect UrlPathPrefix The hardcoded /explore-analyze/ai-features/agent-skills link didn't resolve in preview environments where the URL path has a prefix. Now computed from block.Build.UrlPathPrefix like other internal links. Co-authored-by: Claude <noreply@anthropic.com> Made-with: Cursor * Use absolute URL for agent-skill learn-more link Simpler than UrlPathPrefix computation and works correctly in all environments (production, preview, local). Co-authored-by: Claude <noreply@anthropic.com> Made-with: Cursor * Use UrlPathPrefix for agent-skill learn-more link Compute the learn-more URL from block.Build.UrlPathPrefix so it resolves correctly in all environments (production, preview, local). Co-authored-by: Claude <noreply@anthropic.com> Made-with: Cursor --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 29cf50a commit 1797e4a

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/Elastic.Markdown/Myst/Directives/AgentSkill/AgentSkillView.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{
1414
@Model.RenderBlock()
1515
}
16-
<p><a href="/explore-analyze/ai-features/agent-skills">Learn more about agent skills for Elastic</a></p>
16+
<p><a href="@Model.LearnMoreUrl">Learn more about agent skills for Elastic</a></p>
1717
</div>
1818
<a href="@Model.Url" target="_blank" rel="noopener noreferrer" class="agent-skill-button">
1919
Get the skill

src/Elastic.Markdown/Myst/Directives/AgentSkill/AgentSkillViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ public class AgentSkillViewModel : DirectiveViewModel
88
{
99
public required string Url { get; init; }
1010
public bool HasBody { get; init; }
11+
public required string LearnMoreUrl { get; init; }
1112
}

src/Elastic.Markdown/Myst/Directives/DirectiveHtmlRenderer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,13 @@ private static void WriteAgentSkill(HtmlRenderer renderer, AgentSkillBlock block
229229
if (string.IsNullOrEmpty(block.Url))
230230
return;
231231

232+
var prefix = block.Build.UrlPathPrefix?.TrimEnd('/') ?? string.Empty;
232233
var slice = AgentSkillView.Create(new AgentSkillViewModel
233234
{
234235
DirectiveBlock = block,
235236
Url = block.Url,
236-
HasBody = block.Count > 0
237+
HasBody = block.Count > 0,
238+
LearnMoreUrl = $"{prefix}/explore-analyze/ai-features/agent-skills"
237239
});
238240
RenderRazorSlice(slice, renderer);
239241
}

0 commit comments

Comments
 (0)