Skip to main content
edited tags
Link
Mark Cassidy
  • 25.4k
  • 7
  • 59
  • 117
Source Link
Marcel Gruber
  • 2.3k
  • 1
  • 18
  • 38

How to set link field href attribute to "#"

Using a general link field, I want to be able to author the field such that the final contents of an outputted link are:

<a href="#">Anchor Text</> (notice the empty anchor "#")

I'm rendering this field using the standard field renderer:

@Html.Sitecore().Field("Field Name", someItem)

The problem is that no matter how I author the field, I can never seem to get the href to populate with only #. Is there a way the link field can be authored to output only #?

  • External links always append "http://" when I set the URL to be #
  • If I try to use an anchor link and leave the anchor field empty, the href attribute remains empty
  • If I try to use an anchor link and set the anchor as #, the href attribute has a value of ##