Hyperlink images in content blocks - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Hyperlink images in content blocks

  • Hyperlink images in content blocks
  • I have a site that is almost ready to roll out to a client. I have tried to keep the HTML & CSS so a layman could update content on the site. Yet I am running into issues where the content editor deletes HTML I have entered in HTML view.

    For example, I have some shared content blocks that have two anchor tags. Inside the first anchor, I have an image. In the second anchor I have some text. The first anchor is set to class="imglink", while the second anchor is set to class="link".

    Then there is some short text after the anchors.

    Here is some sample HTML:

    <a href="123" class="imglink">
    <img />

    <a href="123" class="link">
    Some text...

    <p>Some more text...</p>

    I just tried to change out the image outside the first anchor while in Design view. It completely removed the outer anchor tag.

    Since non-technical people are slated to use the site, how do I work around issues like this? I could design a user control, but there is not much time available.
  • Steve,

    Relying on specific markup to survive an edit is asking for frustrated calls from users. I really only use explicit markup in shared content blocks.

    Seems like a custom widget is probably your best bet. Then you can be certain that what you need as output...will be the output.
  • Thanks Tim!

    The one thing that has stopped me from doing a custom widget, besides time, is picking an existing image from the library. Do you have any examples of how to pick an image in a custom widget?

    I do have an example from a reply on another thread. But I am hoping for a simple solution.