导轨 - 高压 - 带标题的链接锚点



我正在使用High_Voltage gem将静态页面集成到我的rails gem中。我想出了如何链接到页面中的锚点(感谢之前的答案。现在我还想为链接添加一个弹出标题。我只是随机尝试

link_to "About", page_path('indexpage', anchor: "aboutsection", title: "MyAboutTitle")

但这呈现为

<a href="/pages/indexpage?title=MyAboutTitle#aboutsection">About</a>

并且,从逻辑上讲,不会产生预期的结果。
有什么建议吗?谢谢!

根据用于添加 html 选项link_to的 Rail API,title参数应放在方法调用中的第三位,如下所示:

link_to "About", page_path('indexpage', anchor: "aboutsection"), title: "MyAboutTitle"

它将输出:

<a href="/pages/indexpage#aboutsection" title="MyAboutTitle">About</a>

最新更新