[Plugin: Akismet] Akismet inserts hidden text (8 posts)

  1. LachlanM
    Posted 5 years ago #

    I've just noticed that Akismet inserts a hidden form field by wrapping it in p tags with display set to none.

    <p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="6036a63c2f" /></p>

    This breaks my HTML validation, and more importantly violates Googles guidelines to not include hidden text...

    I don't want to lose Akismet's great spam fighting capabilities, however the hidden text is a little worrisome...

    Any thoughts?

  2. Joseph Scott
    Posted 5 years ago #

    It looks like your theme is adding an P tag that wraps around that, which is what triggers the validation error.

    What Google guide is the hidden form violating?

    WordPress uses nonces in several places, in this case Akismet is using it as another data point in watching for spam comments.

  3. LachlanM
    Posted 5 years ago #

    Thanks Joseph,

    I'm noticing this on many sites, with a variety of themes.

    Here are the Google guidelines:
    They do penalize for this in many instances.

    Here is a post on my Mother's piano lessons blog, which is using the default WP theme, Twenty Ten:

    There is an entire H3 hidden as follows:
    <h3 id="reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/pianolesson-nine-the-diminished-chord/#respond" style="display:none;">Cancel reply</a></small></h3>

    As well as:
    <p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="455fb56600" /></p>

  4. Joseph Scott
    Posted 5 years ago #

    The form field has no text or links, so that guideline doesn't appear to apply.

    That link passes the W3C validator - http://validator.w3.org/check?uri=http%3A%2F%2Fpianolessons.forbeginners.me%2Fpianolesson-nine-the-diminished-chord%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

  5. LachlanM
    Posted 5 years ago #

    Hi Joseph,

    Thx for your reply. I apologise if all this seems pedantic, and I should clarify that I am only concerned because I am trying to troubleshoot a Google penalty for another site. I usually don't see an issue with such small things, but in this instance, with my desire to get to the bottom of Google's behavior, I have vowed that no stone shall remain unturned.

    You are correct about the validation, I must have accidentally checked as XHTML 1.0 Transitional. I went straight from Web Developer tool bar in FF...

    However, Google is quite clear about hidden text and links, and the below would appear to potentially still be in violation (who knows with Google...):
    <a rel="nofollow" id="cancel-comment-reply-link" href="/pianolesson-nine-the-diminished-chord/#respond" style="display:none;">Cancel reply</a>

    Here is a page with comments from a site based on the popular Motion theme:
    This has the exact same markup generated as in my Mother's site. However, the theme developer has built it as XHTML 1.0 Transitional, so in this instance the same output does not validate:

    It seems to me that Akismet is generating invalid HTML if it is used on an XHTML 1.0 Transitional theme?

  6. Joseph Scott
    Posted 5 years ago #

    The 'Cancel reply' link is not added by Akismet, but is a core WordPress feature that is used to support threaded comments. Also note that it uses nofollow to specifically tell Google that this shouldn't be used to pass pagerank and such.

    The hidden field that Akismet includes in the comment form is wrapped in a P tag, it appears that your theme is wrapping it in an additional P tag.

    Looking through the errors you linked to - http://validator.w3.org/check?uri=http%3A%2F%2Fpianolessons.forbeginners.me%2Fpianolesson-nine-the-diminished-chord%2F&charset=%28detect+automatically%29&doctype=XHTML+1.0+Transitional&group=0&verbose=1&user-agent=W3C_Validator%2F1.2 - none them mention the field that Akismet adds.

    I recommend trying to contact Google if that is the source of your concerns.

  7. LachlanM
    Posted 5 years ago #

    I pasted the wrong validator link - it was the same one in my first post... sorry.

    The first error does mention Akismet.

    However I take your point about nofollow being added, etc. Thanks.

  8. atxutexas05
    Posted 4 years ago #

    Hey guys,

    I was having the same problem with the code being invalid due to the <p style="display: none;">'; paragraph code.

    Here is the solution, open and edit the akismet.php in a text editor or dreamweaver, etc.

    Go to line 498 and change the p to span
    <span style="display: none;">';

    Then change the closing tag </p> to </span>

    Your page will now pass validation!! More information at Austin Web Design

Topic Closed

This topic has been closed to new replies.

About this Topic