Disqus wants me to add an attribute called data-disqus-identifier
to my links, but for obvious reasons, n开发者_StackOverflow社区ew { @data-disqus-identifier = "article" }
gives me a syntax error.
Any idea what to do in these situations?
Thanks,
Rei
You can pass a Dictionary<string, object>
with arbitrary string keys.
The syntax will be more verbose: new Dictionary<string, object> { { "data-disqus-identifier", "article" } }
.
You may want to create an extension method or a static method on a static class with a short name that takes a smaller parameter set and returns the dictionary.
In MVC 3, if you use underscore _
instead of hyphens -
in your property names then MVC will automatically convert them to hyphens in the resulting HTML. So, something like this should work for you:
new { data_disqus_identifier = "article" }
精彩评论