Streaming live at 10am (PST)

How to add HTML comments?

#1

I am trying to get our site added to NewsNow, but one of the requirements is as follows:

===================

Insert HTML comment tags in your article webpage templates as follows:

  1. <!-- Article Start --> should follow the headline but immediately precede the first paragraph of the article
  2. <!-- Article End --> should immediately follow the last paragraph of the article.
  3. If your articles contain a byline or specify an author then <!-- Author Start --> should immediately precede the author’s name and <!-- Author End --> should immediately follow it.

===============

Can someone advise how I can alter the Articles template to add this code for all articles please? I can’t see a way of doing it in the settings on the project for that page.

Cheers!


Here is my public share link: LINK

#2

You actually can’t, unless you’re ok with your comments being wrapped inside of divs.

You can use custom code for that. Although instead of just adding the comments, it’s going to add the comments and wrap them in a div. Which should work anyway.

And

Result: comments wrapped in divs instead of being inserted in the code.

Your instructions state that comments should immediately follow elements, so I’m not confident this will work.

If you have the possibility to add a special class to your first and last paragraph, as well as to your author names elements, there’s maybe a custom code solution using pseudo elements ::before and ::after.

Also you may want to read about HTML5 proper tags.

Select any element and go in the settings tab to set the HTML5 tag.

You can read this for usefull info on HTML5 tags https://webflow.com/blog/html5-semantic-elements-and-webflow-the-essential-guide

1 Like
#3

Hi Vincent,

Thanks - I’ve added a couple of elements and will see if that’s enough to get through registration.

Cheers!