Hyperlinks aren't working in SharePoint List Gallery View

rogerpower365 0 Reputation points
2023-04-27T19:13:01.7533333+00:00

Hi All,

I have a SharePoint list which hyperlink columns. in Gallery view, the links aren't working. In stead of opening the links, the item itself opens in edit mode.

I have those links in Green fonts and underlined to make it look like Links via Column Formatting.

Do I need to change some settings to open links? or Update JSON code or something?

Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Vahid Ghafarpour 23,385 Reputation points Volunteer Moderator
    2023-04-28T02:25:49.3133333+00:00

    It sounds like you may need to update the column formatting JSON code to properly render the hyperlink column as a clickable link in the Gallery view.

    To do this, you'll need to modify the "fieldTypes" section of your column formatting JSON code to include the appropriate hyperlink formatting. Here's an example of what the JSON code might look like:

    {
    
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
    
      "elmType": "a",
    
      "txtContent": "@currentField.desc",
    
      "attributes": {
    
        "target": "_blank",
    
        "href": "@currentField"
    
      },
    
      "style": {
    
        "color": "green",
    
        "text-decoration": "underline"
    
      }
    
    }
    

    In this example, the "elmType" is set to "a" to indicate that this is a hyperlink element. The "txtContent" property sets the text that will be displayed as the hyperlink. The "attributes" property sets the target and href attributes of the hyperlink element, which are necessary for the link to work properly. Finally, the "style" property sets the formatting of the hyperlink, including the green color and underline.

    You can modify this code to match your specific column name and formatting requirements. Once you've updated the code, save it and apply it to your SharePoint list column. The links should now be clickable in the Gallery view.

    1 person found this answer helpful.

  2. AllenXu-MSFT 24,951 Reputation points Moderator
    2023-04-28T02:20:53.6+00:00

    Hi @rogerpower365,

    I couldn't reproduce this issue on my end. As per my test, I can still open the links in Gallery view.

    galleryview

    I'm wondering if your JSON code caused this issue, could you please share your code here so I can have a test from my side. Also, did you apply any JSON code to your gallery view or just apply to the hyperlink column?


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. AllenXu-MSFT 24,951 Reputation points Moderator
    2023-05-04T01:47:40.0033333+00:00

    Hi @rogerpower365,

    As per my experience, this issue is mostly like to be caused by your JSON formatting code applied to the Gallery view. As said by Vahid Ghafarpour, you should modify the "fieldTypes" section of your column formatting JSON code to include the appropriate hyperlink formatting. I will be grateful if you can share the result of modifying the JSON code to hyperlink formatting.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.