Schema.org property to link items to WebPage - microdata

This is my HTML format for all pages:
<html>
<head>
...
</head>
<body>
<p>...</p>
<slide>...</slide>
</body>
</html>
I want to set Microdata for that. Which format of these is correct?
<html itemscope itemtype="http://schema.org/WebPage">
<head>
<meta itemprop="name" content="webpage"/>
</head>
<body>
<p itemprop="mainContentOfPage" itemscope itemtype="http://schema.org/Article">
<meta itemprop="name" content="article"/>
</p>
<slide itemscope itemtype="http://schema.org/WPSideBar">.
<meta itemprop="name" content="slide"/>
</slide>
</body>
</html>
It seems above code is correct but when I check it on Google lab, it does not show that the slide tag is a child of WebPage. This is the result:
Item
type: http://schema.org/webpage
property:
name: webpage
maincontentofpage:
Item 1
Item 1
type: http://schema.org/article
property:
name: article
Item
type: http://schema.org/wpsidebar
property:
name: slide
So I try to solve this issue by adding a new itemprop. The best itemprop that I could find is 'text' or 'about':
<html itemscope itemtype="http://schema.org/WebPage">
<head>
<meta itemprop="name" content="webpage"/>
</head>
<body>
<p itemprop="about mainContentOfPage" itemscope itemtype="http://schema.org/Article">
<meta itemprop="name" content="article"/>
</p>
<slide itemprop="about" itemscope itemtype="http://schema.org/WPSideBar">.
<meta itemprop="name" content="slide"/>
</slide>
</body>
</html>
Now if I test it on Google lab the result is this:
Item
type: http://schema.org/webpage
property:
name: webpage
about: Item 1
maincontentofpage: Item 1
about: Item 2
Item 1
type: http://schema.org/article
property:
name: article
Item 2
type: http://schema.org/wpsidebar
property:
name: slide
Apparently the problem is solved and now Google knows 'slide' is a child of WebPage!
But my problem:
I do not feel good. Does this property really fit? ('about' or 'text')

Yes, if you want to relate the items to the WebPage, you have to use a property.
For the main content, we have mainContentOfPage. But what about elements that are not (part of) the main content?
Here’s a discussion about such a generic property for linking a WebPageElement to WebPage:
Am I right that WebPage lacks a generic property for linking to WebPageElement?
There is a proposal for a hasPart property: "A related CreativeWork that is included either logically or physically in this CreativeWork". This would be a good match, but until it becomes part of Schema.org (if at all), we’d have to use what is already there.
Possible existing properties could be:
about
citation
mentions
text
text has the problem that it expects Text, not another item. citation is probably, at least according to its description, meant for more specific cases. That leaves us with mentions and about, but both aren’t really fitting either.
So I’d say: Currently there is no good solution.
Personally, I’d just omit a property and leave the item unlinked (until a suitable property gets added to Schema.org).

Related

Thymeleaf can not find internationalized messages

I tried searching on Google but could not find any solution to my problem.
The link for code is
https://github.com/optimus29/ThymeleafDemo
I get the following output on running the JUnit test com.jk.th.mail.util.MailTemplateTest.java :
----------------------------------------------
* Mail contents *
----------------------------------------------
Recipients: def#mail.com
Subject: Complete registraion process
Message:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>??subject.registration.complete_en_US??</title>
</head>
<body>
<p>??grettings.user_en_US??</p>
<p>??registration.text.line1_en_US??</p>
<p>
??registration.link.text_en_US??
</p>
<p>??registration.text.line2_en_US??</p>
<div>
<p>
<span>??thanks_en_US??</span><br/>
<span>??pustakalaya.team_en_US??</span><br/>
<span>??contact.mail_en_US??</span><br/>
<span>??contact.number_en_US??</span>
</p>
</div>
</body>
</html>
----------------------------------------------
I'm not really sure what is not right in the way you wrote the configuration, but...
Since you are using the default paths anyway, you could just remove the call (in SpringMailConfig.springTemplateEngine()):
templateEngine.setMessageResolver(messageResolver());
Then you may also remove the beans messageResolver and emailMessageSource.
After you do this, the only unresolved message will be "grettings" (because it's misspelled).

How to index file contents

I have a server at batalabs.tk where I use batch files as most of my CGI scripts, I am currently trying to make an Indexing service for a search script...
Example files:
Directory to search:
<DIR HTDOCS>
index.html
otherpage1.html
otherpage2.html
</DIR>
index.html:
<HTML>
<HEAD>
<TITLE>MyWebsite - Buy Products</TITLE>
<META NAME="Description" Content="Buy Software and products from MyWebsite">
</HEAD>
<BODY>
<DIV ALIGN="CENTER">
<H2>Software</H2>
<h4>Find the latest and greatest in software right here at the Shop Page!</h4>
<hr>
Lorum - Free Cloud Storage
<hr>
Ipsum - Free Networking Software
<hr>
</div>
Copyright MyWebsite.com, 2016
</body>
</html>
Otherpage1.html
<html>
<head>
<title>Page One - Hello World!</title>
<META Name="Description" Content="Hello World Page For Testing.">
</head>
<body>
<h1>
Hello, World!
</h1>
<div>
<pre>
this is an example page for use with testing.
Any of these words can be searched and should (optimally) show this page in the results.
</pre>
</div>
</body>
</html>
otherpage2.html:
<html>
<head>
<title>Page Two - The Revenge Of The Coder</title>
<meta Name="Tags" content="dummy; coder; file; otherpage2;;">
</head>
<body>
<pre>
Hello, This file doesn't matter. At all. It is a dummy.
</pre>
</body>
</html>
These are just example files, But i want my batch file to pick up on the
<META> tag with Description and Tags, as well as the file's name, every word in the body,
and the title... I've tried some stuff to no avail, any help?
So maybe a user could type "dummy" as their keyword, and Otherpage2.html would pop up like so:
Page Two - The Revenge Of The Coder
HTTPS://www.batalabs.tk/otherpage2.html
Hello, this file doesn't matter. At all. It is a dummy.

choice primary images in microdata schema.org

I know 'primaryImageOfPage' is a property of WebPage.
But 'primaryImageOfPage' isn't a property of Article.
For this code:
<html itemscope itemtype="http://schema.org/webpage">
<head>
<meta itemprop="name" content="webpage"/>
</head>
<body>
<p itemprop="mainContentOfPage" itemscope itemtype="http://schema.org/Article">
<img src"example1.png" itemprop="image"/>
<img src"example2.png" itemprop="image"/>
<img src"example3.png" itemprop="image"/>
<img src"example4.png" itemprop="image"/>
</p>
</body>
</html>
How can I choice Primaery picture for Article?
Dose Article inherits from Webpage?
FOr example:
<html itemscope itemtype="http://schema.org/webpage">
<head>
<meta itemprop="name" content="webpage"/>
</head>
<body>
<p itemprop="mainContentOfPage" itemscope itemtype="http://schema.org/Article">
<img src"example1.png" itemprop="primaryImageOfPage"/>
<img src"example2.png" itemprop="image"/>
<img src"example3.png" itemprop="image"/>
<img src"example4.png" itemprop="image"/>
</p>
</body>
</html>
Does Article inherit from WebPage?
No. You can’t use primaryImageOfPage for Article.
While it makes sense to specify the main content/image of a WebPage, would it also make sense to specify this for an Article? I’d say that an Article should only contain main content/images in the first place.
If there is an image the whole Article is about, you could use the about property. Example: interpretation of a painting. If this image is from a different source, you could use the citation property in addition.
For images being part of the Article, there is the associatedMedia property. While its description is somewhat confusing, it got discussed that this property could be used for linking images (or other media) that belong to or are part of the Article (currently, it has the synonym encoding, which they planned to remove; I don’t know why that did not happen yet).
Note that I wouldn’t use the image property for all images that are part of the Article. I think this property should only be used for images of the Article itself, i.e., images representing this whole Article. This could be a screenshot of the Article, a thumbnail, maybe a lead picture.
So, you could use associatedMedia for the main image(s) and no property for secondary images:
<article itemscope itemtype="http://schema.org/Article">
<span itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<img itemprop="contentUrl" src"main-image.png" alt="…" />
</span>
<img src"secondary-image-1.png" alt="…" />
<img src"secondary-image-2.png" alt="…" />
<img src"secondary-image-3.png" alt="…" />
</article>

jQuery mobile "pageinit" calls hashtag for short time

I'm currently building a page with jQuery mobile.
I need to load some custon JavaScript on one page, so I found the pageInit function.
Here's a short example of what i'm using:
page1.html:
<!doctype html>
<meta charset="uft-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>page1 | test page for jquery mobile</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css">
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
<script src="js.js"></script>
<div data-role="page" id="page1">
<div data-role="header">
<h1>Page 1 Title</h1>
</div>
<div data-role="content">
go to page2
<p>Page 1 content goes here.</p>
</div>
<div data-role="footer">
<h4>Page 1 Footer</h4>
</div>
</div>
page2.html:
<!doctype html>
<meta charset="uft-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>page1 | test page for jquery mobile</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.css">
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.0/jquery.mobile-1.3.0.min.js"></script>
<script src="js.js"></script>
<div data-role="page" id="page2">
<div data-role="header">
<h1>Page 2 Title</h1>
</div>
<div data-role="content">
go to page1
<p id="addstuff">Page 2 content goes here.</p>
</div>
<div data-role="footer">
<h4>Page 2 Footer</h4>
</div>
</div>
js.js
$(document).delegate('#page2', 'pageinit', function() {
$('<div />', {
html: 'Some text that was added via jQuery'
}).appendTo('#addstuff');
});
So I need to execute some JavaScript on page2.html. It actually works great (the div was created and you see the text). But when I'm clicking on a link to change the page, you can see, that jQuery is calling a hashtag in the URL first. So it looks like:
example.org/page1.html#/page2.html
when I clicked on the link on page1.html (just for a few milliseconds maybe) and then it redirects to
example.org/page2.html
I guess it's because of the id .. but I need this one for the pageInit (as far as I know).
Is this behavior normal ? Or am I doing something wrong. Maybe there's even a command to not call the hash tag.
Here you go:
It's important to note that if you are linking from a mobile page that was loaded via AJAX to a page that contains multiple internal pages, you need to add a rel="external" or data-ajax="false" to the link. This tells the framework to do a full page reload to clear out the AJAX hash in the URL. This is critical because AJAX pages use the hash (#) to track the AJAX history, while multiple internal pages use the hash to indicate internal pages so there will be conflicts in the hash between these two modes.
For example, a link to a page containing multiple internal pages would
look like this:
< a href="multipage.html" rel="external">Multi-page link< /a>
Src: http://view.jquerymobile.com/1.3.0/#Linkingwithinamulti-pagedocument

Yield in view for multiple blocks

I am writing a small Sinatra-based app and would like each view to be able to insert various items into the layout, for example the page title or extra CSS/javascript references in the head.
Currently my layout (erb) looks like this (simplified):
<html>
<head>
<title>Hard Coded Title Here</title>
<link rel="stylesheet" ... />
</head>
<body>
<h1>Hard Coded Title Here</h1>
<div id="content">
<%= yield %>
</div>
</body>
</html>
Rather than having the title and CSS/JS references hard coded, I'd like to achieve something along these lines:
<html>
<head>
<title><%= yield :title %></title>
<link rel="stylesheet" ... />
<%= yield :more_head_refs %>
</head>
<body>
<h1><%= yield :title %></h1>
<div id="content">
<%= yield %>
</div>
</body>
</html>
And be able to define the content for those blocks from within each view.
Is this possible, and if so how would I go about doing it?
I came up against this issue at Railscamp recently and luckily Tim Lucas was able to point me to something he forked and worked on called sinatra-content-for. This will cover what you need.
I've found this to be the most robust solution for Rails-style 'content_for' functionality in Sinatra, especially if you're using ERB templates rather than Haml:
http://github.com/kematzy/sinatra-outputbuffer
You can just use #stylesheet in your ruby file

Resources