Add comments in the Sharepoint HTML Source Code

Anaya, Suzanne 96 Reputation points
2021-03-01T17:06:26.517+00:00

I have a Sharepoint page where there is a lot of source code. In Access, SQL... I am able to insert comments to help describe the active code. Is there a way that I can insert comments in which will help to decipher the code on Sharepoint HTML Source. I tried entering <! -- --> and also trying Cntl+/ and nothing seems to work. I've also tried <%-- xxxx --%> in the code, but then it shows on my Sharepoint page.

Microsoft 365 and Office SharePoint For business Windows
{count} votes

Accepted answer
  1. Anaya, Suzanne 96 Reputation points
    2021-03-03T14:42:13.73+00:00

    Thank you - I entered the code to my Sharepoint page. The text "test content" and "===============" showed on my page and the "<!-- test comment-->" did not. That is what I was looking for. Unfortunately, when I went back into my HTML Source code the "<!-- test comment-->" was gone.
    What I was hoping for is a way to enter a hidden comment that would stay with the code in which I could type in a comment that could describe the code. That way when others or myself are editing the code it may make it a little easier to read through the code.

    73882-4-edit.png


1 additional answer

Sort by: Most helpful
  1. Amos Wu-MSFT 4,051 Reputation points
    2021-03-03T08:28:44.657+00:00

    You could add a script editor web part to the page and add the comment in the script editor web part.
    73708-image.png
    Updated:
    74139-image-min.gif


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.


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.