如何在 ASP.NET WebForms 中制作 SEO 友好的 DropDownList?
我需要在页面上呈现一些 DropDownList,允许用户选择不同的类别和类别。位置以便根据其选择返回不同的结果集。
但是,我希望每个结果选择都是可抓取的。我知道我可以将每个可能的类别、位置等呈现为页面上的标准 HTML 链接,这些链接对指定的 URL 执行 GET 请求,但如果可能的话,我希望将所有这些选项包含在 DropDownList 中,以保持内容不那么混乱。
如果我使用 MVC,我会考虑将页面的一小部分包装在 GET 表单中,每个 ListItem 值都是目标 URL(尽管我想知道这种方法是否可以正确抓取?)。
我正在使用 Web 表单,但在尝试提出解决方案时遇到了麻烦。
I need to render a few DropDownLists on my page, allowing the user to select different Categories & Locations so as to return different result sets based on their selection.
However, I want each of the resulting selections to be crawlable. I know I could just render every possible Category, Location etc as standard HTML links on the page, which perform a GET request to the specified URL, but if possible I'd like to contain all these options within a DropDownList to keep things less cluttered.
If I were using MVC I would consider wrapping that small section of the page in a GET form, with each ListItem value being the destination URL (though I wonder if even this approach would be properly crawlable?).
I am using Web Forms though and am just having trouble trying to come up with a solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
需要考虑的一些想法...渲染无序列表的链接,然后使用 CSS / jQuery / JavaScript 方法将它们设置为菜单样式,使用诸如 http://javascript-array.com/scripts/jquery_simple_drop_down_menu/?这将确保它们仍然是可抓取的链接,并将以下拉列表样式的方式呈现给用户。
或者另一个想法,可能更轻量级的是仅使用 jQuery 从无序列表中动态呈现下拉列表。然后,当用户选择下拉列表项时,您将引导用户访问他们在客户端选择的链接。
Some ideas to consider...render unordered lists of links, and then use a CSS / jQuery / JavaScript approach to style them as menus, using approaches such as http://javascript-array.com/scripts/jquery_simple_drop_down_menu/? That will ensure that they are still crawlable links, and will be presented to users in a drop down list style fashion.
Or another idea, possibly more lightweight would be to just use jQuery to dynamically render drop down list from your unordered lists. Then when a user selected a drop down list item, you would direct the user to their selected link on the client side.
没有法律规定您根本需要旧的
还可以使用一些创造性的 CSS 将启用 GET 的表单放在 HTML 流内容之外,但将其拉到用户想要的位置。
No law says you need that old
<form runat="server" />
at all.Could also use some creative CSS to put the GET enabled form outside the content HTML-flow-wise but pull it to where you want for the users.