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 ##
  • Why do you want to set it do "#"? and should it always be "#" or only when a content author specifies?
    – Richard Seal
    Nov 4, 2020 at 21:02
  • @RichardSeal Always "#" only when a content author specifies. I understand that this is a bit of a silly question, but I want to know if this will require a code intervention or if I can solve the issue with a minor content tweak. Nov 4, 2020 at 21:21

1 Answer 1


Use Insert JavaScript option

enter image description here

Specify Link description only (in your case 'Anchor Text')


Field raw value

<link text="Anchor Text" linktype="javascript" url="" anchor="" />

HTML Output:

<a href="#">Anchor Text</a>

  • This is exactly what I was looking for! As a side note, this will also automatically add onclick="javascript:;return false;" to the element. Nov 6, 2020 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.