valid xhtml meta tags for facebook open-graph and twitter cards - facebook-graph-api

to make valid:
xhtml
twitter cards
facebook-graph-api
for http://www.theyact.com/acting-classes/los-angeles/
I've managed to get my code to come up valid everywhere...
save 1 error on
http://validator.w3.org/
there is no attribute "property"
but only 1 instance among the many in the code, only the below seems to ruffle the validator's feathers:
<meta name="og:description" property="og:description" content="...
I'd like the code to be completely valid in validator.w3.org's eyes. What am I missing?

If you remove this element, the validator will complain about the next one containing the property attribute.
The property attribute is part of RDFa, but your DOCTYPE doesn’t allow the use of RDFa.
If you want to keep using XHTML 1.1, you could change it to:
for RDFa 1.0: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
for RDFa 1.1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
Or simply switch to (X)HTML5, which comes with RDFa 1.1 support.

Related

Parse HTML with BeautifulSoup replaces existing HTML tag

I am using BeautifulSoup v4 to parse out a string of HTML that looks like this:
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head></head>
<body><p>Hello, world</p></body>
</html>
Here is how I am parsing it:
soup = BeautifulSoup(html)
Where html is the pasted HTML above. For whatever reason, BS keeps replaces the <html> tag with a standard tag without the extra meta info. Any way I can tell BS to not do this?
I was able to figure it out by passing in html5lib as the HTML parser to BS. But, now, it keeps dropping in a random HTML comment tag for the DOCTYPE
<!--<!DOCTYPE HTML-->

Sitemap in Django - Titles don't show in google search

I have followed the steps in the documentation and it seems to be working as expected.
I have got an automated sitemap generated: https://duelify.com/sitemap.xml
Yet somehow there is no way to specify the title.
If I search in google for my site: site:duelify.com and scroll down I see the main site's title for every link:
Duelify | Duel Your Friends & Foes
https://duelify.com/topics/discuss/2/vegetarian-diet/
That doesn't look right.
If I try this with Stackoverflow:
site:stackoverflow.com django
Each entry has a proper title.
How could I achieve that? It is not clear from the given site map references.
The title displayed in Google search results has nothing to do with the sitemap.
Use meta (http://www.w3schools.com/tags/tag_meta.asp) and title tags:
<head>
<meta name="description" content="Your page description">
<title>Your page title</title>
</head>
And don't forget to set proper HTML heading tags.

Adding custom meta tags for every different page in Joomla

I use Joomla 2.5. I want to set a meta tag property named "com.silverpop.pagename" for each page (article) in my website. For example, my homepage will have:
<meta name="com.silverpop.pagename" content="Home Page" />
My blog will have:
<meta name="com.silverpop.pagename" content="Blog" />
How do I do that?
I was suffering with the same problem when I had to add Facebook Open graph META Tags on my Joomla project.
<meta property="og:type" content="article"/>;
I had included this code on my Joomla template and it worked for me, please have a look:
# add Facebook tags
$doc = JFactory::getDocument();
$doc->addCustomTag("<meta property='og:type' content='article'/>");
Also you can refer this Link.
Hope it will help others.
You need to modify the header. This can be done editing
JOOMLA_ROOT\libraries\joomla\document\html\renderer\head.php
Here you can change the behaviour of header

HTML parsing using pugixml or an actual HTML parser

I'm interested in using pugixml to parse HTML documents, but HTML has some optional closing tags. Here is an example: <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
Pugixml stops reading the HTML as soon as it encounters a tag that's not closed, but in HTML missing a closing tag does not necessarily mean that there is a start-end tag mismatch.
A simple test of parsing the HTML documentation of pugixml fails because the meta tag is the second line of the HTML document: http://pugixml.googlecode.com/svn/tags/latest/docs/quickstart.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>pugixml 1.0</title>
<link rel="stylesheet" href="pugixml.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="quickstart.html" title="pugixml 1.0">
</head>
<!--- etc... -->
A lot of HTML documents in the wild would fail if I try to parse them with pugixml. Is there a way to avoid that? If there is no way to "fix" that, then is there another HTML parsing tool that's as about as fast as pugixml?
Update
It would also be great if the HTML parser also supports XPATH.
I ended up taking pugixml, converting it into an HTML parser and I created a github project for it: https://github.com/rofldev/pugihtml
For now it's not fully compliant with the HTML specifications, but it does a decent enough job at parsing HTML that I can use it. I'm working on making it compliant with the HTML specifications.
One way to address this is to do some pre-processing that converts the HTML to XHTML, then it would "officially" be considered XML and usable with XML tools. If you want to go that route, see this question: How to convert HTML to XHTML?

Can I use an <img> tag to send cookies across domains?

Look at this situation:
www.websitea.com displays an img tag with a src attribute of www.websiteb.com/image.aspx?id=5 and style="display:none"
www.websiteb.com returns an clear image, in addition to a cookie with a name of referrer and value of 5 (created server-side from validated querystring.)
Would the cookie be created on domain www.websitea.com or www.websiteb.com?
Currently I'm sure a series of redirects with querystrings and to achieve cross-domain cookies, but I came up with this image idea a little ago. I guess I could also use an iframe.
Thanks!
Check out:
cross-domain-user-tracking
Someone mentions using a 1x1 image for tracking across domains.
The cookie would be created for websiteb.com.
The cookie is created from the request to websiteb.com so yea... the cookie goes to websiteb scope
You're on the right track. As others have mentioned, the cookie would be created for websiteb.com.
To overcome issues with IE you'll probably need to ad a Compact Privacy policy.
Start here: http://msdn.microsoft.com/en-us/library/ms537342.aspx and Google for the rest.
Ok looks good. Tested in all browsers. Added a P3P tag for IE6, not sure if it was necessary though.
<%# Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Response.AddHeader("P3P", "CP=""CAO PSA OUR""")
Dim passedlocalizeID As String = Request.QueryString("id")
Dim localizeID As Integer
If passedlocalizeID IsNot Nothing AndAlso Int32.TryParse(passedlocalizeID, localizeID) Then
Dim localizer As New Localizer
localizer.LocalizeTo(localizeID)
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Redirecting . . .</title>
<meta http-equiv="refresh" content="0;URL=/" />
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>