Schema markup: WebPage vs Article - markup

I'm providing a website about my health-related services, with a few pages describing my practice and services, my approach of work, and many articles about specific topics related to my field of work (imagine what a doctor or therapist is doing, that should give the idea).
But I'm confused whether to define my pages as "Webpage" or "Article"?
I defined them as 'Article' now, which in turn disallows me from tagging my phone number with
<span itemprop="telephone">
though, according to Google's Structured Data testing tool.

In the typical case, you would use both. You could provide a WebPage item on every page, and if the web page contains an article, you could provide an Article item in addition (or multiple, of course).
For a page dedicated to an article, you could use the mainEntity property to denote that the Article is the primary thing on that page:
<body itemscope itemtype="http://schema.org/WebPage">
<article itemprop="mainEntity" itemscope itemtype="http://schema.org/Article">
</article>
</body>
Neither a web page nor an article can have a telephone number (at least not in typical cases, which is why Schema.org doesn’t define the telephone property for WebPage/Article). A telephone number typically belongs to a person or an organization, which are among the types that can have the telephone property.
So you need an item that represents your business: in your case probably LocalBusiness. Then you can provide this item as author of the WebPage and/or the Article etc.
PS: Whenevery you use a type, check if a more specific child type applies in your case. So in your case maybe something like MedicalWebPage, NewsArticle, HealthAndBeautyBusiness, etc.

Related

Should I Provide Data In Routing Logic or Meteor Template Helper?

Example:
I am writing a Meteor app that deals with a list of blog posts. All blog posts are stored in a collection called 'Posts'. I use Iron Router for routing.
I want to show the user a list of all the posts created by a particular author. This list will be displayed using Spacebars. Therefore, I need to provide the data to the template.
Problem:
As far as I know, there are two ways to do this:
Using template helpers
Using the 'data'-property of my route
Option 1 example:
Template.postList.helpers({
postsToDisplay: function(){
return Posts.find({author: 'someAuthor'});
}
})
Option 2 example:
//Inside my route
data: function(){
return {postsToDisplay: Posts.find({author: 'someAuthor'})};
}
Question
Are there any significant differences between those two methods? Is there a reason to prefer one over the other? Does one deliver better performance?
Thank you very much for your answers!
Are there any significant differences between those two methods? Does one deliver better performance?
Not really, it's just design choices after all.
Is there a reason to prefer one over the other?
I would stick to the iron-router + data method, here is why :
You can use waitOn to actually display the list only when data fetched from the server is ready, using Router.onBeforeAction("loading") and a loadingTemplate improves overall user experience.
You can design a data agnostic postsList template that you can feed with different contexts.
The last point is particularly interesting, because it allows you to define a reusable template that you could use to display the list of recent posts, the list of posts in a category, the list of posts by a certain author as you want to achieve in the first place, etc...
<template name="postsList">
{{#each posts}}
{{> postListItem}}
{{/each}}
</template>
Here you could define posts as a helper of postsList, but it's better to let the parent template that will call postsList assign posts to whatever it needs to.
template:"postsList",
data:function(){
return {
posts:Posts.find({
"author":this.params.author
})
};
}
This design pattern allows us to define a route that provides a data context which represents the list of posts by a given author, but you could also define another route providing a data context which will list posts by category.
So by moving out the data provider role from the template helper to the route definition, we have a much more reusable template, which is nice.

Properties outside of 'itemscope' are assumed to belong to 'WebPage', but this creates invalid Microdata

Microdata allows elements with itemprop but without parent itemscope, as long as they are referenced by an itemref somewhere on the page. (See my question Is 'itemprop' without parent 'itemscope' valid? Does it create an item?).
So this example should be valid:
<body>
<div itemprop="email" id="orphan">
alice#example.com
</div>
<div itemscope itemtype="http://example.org/Person" itemref="orphan">
<span itemprop="name">Alice</span>
</div>
</body>
Now, when someone is using the Schema.org vocabulary instead (replacing "example" with "schema" in the itemtype value), it’s my understanding that this example would no longer be valid, because on http://schema.org/WebPage it says:
Every web page is implicitly assumed to be declared to be of type WebPage, so the various properties about that webpage, such as breadcrumb may be used. We recommend explicit declaration if these properties are specified, but if they are found outside of an itemscope, they will be assumed to be about the page
So this would mean that the following items and name-value pairs would be created:
Item <http://schema.org/Person>
name: Alice
email: alice#example.com
Item <http://schema.org/WebPage>
email: alice#example.com
But http://schema.org/WebPage can’t have an email property, so this is invalid Microdata, as in this case the itemprop value has to be
[…] a defined property name allowed in this situation according to the specification that defines the relevant types for the item
So this statement on http://schema.org/WebPage, if respected by consumers and implementors, would result in invalid Microdata in cases where an element with itemprop has no itemscope parent and the property is not allowed on WebPage.
Is this correct or am I missing something?
How should I deal with this? Ignore this statement? AFAIK Microdata doesn’t require to follow those "informal rules", right?
It's not often discussed in these terms, but validity is a relative concept. A document is valid or invalid only with respect to the requirements of a particular specification.
In this case, the microdata spec says nothing about WebPage, so the inclusion of the itemprop in an implicit WebPage item has no effect on the validity of your document with respect to the Microdata spec.
On the other hand, with respect to the schema.org WebPage spec, your document, or at least the WebPage item within it, would be invalid.
Whether this matters to you or not is your choice. There are really only two practical outcomes. A consumer of the microdata of your page can either create a WebPage item, or not create WebPage item. It is highly unlikely that a consumer would refuse to create a WebPage item because of the presence an additional out-of-schema itemprop, where it would have created the WebPage item otherwise.
And that's ultimately what validity is all about. It's there to establish a common language that producers and consumers of documents both understand. Providing that consumers understand the information that producers provide, technical violations of the validity rules of any particular specification are of little consequence.

ajax search form for ColdFusion

I am looking for some technique like search form or form filter.
This is a reference .
It is a hotel finding website.
My question is here, how to use coldfusion to create this kind of searching form with ajax?
Please give me some idea or tips , i will appreciate with you assist !
I have just get some idea on ajax search form with text.
<form>
Search: <input type="text" name="search">
<input type="button" value="Search">
</form>
<cfdiv bind="url:movieresults.cfm?search={search}">
</cfdiv>
In general terms, a search form in CF has the same basic concept as a search form in any other format: you have a form wherein you allow the user to supply search criteria and you have some collection of data to search against. So, you see the actual search form itself is only but a small part of searching. You need to construct the data object you will search against and you need to build the pieces to add to that collection (if necessary) and maintain it. Tossing in the Ajax interface will only complicate matters so I'd recommend you stick with a basic search HTML form and once you've mastered submitting a search, doing the search through your data collection and returning that collection to the user in the form of a useful results page...only then should you consider modifying it to run with an Ajax engine.
A good place to start for how to work with cfindex and cfsearch (Coldfusion's tags that create the data collection and to search against that collection) would be found here.
Walking before running, grasshopper. If you encounter any specific problems, feel free to come back here and we'll see what we can do for you. In the meantime, check out our ColdFusion resources thread. It has a great many links to common CF resources that all CF devs, beginners to experts, need/use to help get the job done.

Aliasing ID parameter in URL as string in ASP.NET MVC 4

What i'm trying to do is to rewrite URLs to make them more SEO friendly but i still want to pass a parameter as an int ID.
For example, a URL pointing to a news article might look like this:
"www.domain.com/category-id/article-id" or "domain.com/5/3"
What i want to do is to rewrite the URL everywhere so that the title of the category and the title of the article are written into the URL so it becomes f.x. "domain.com/politics/some-title" but i still want to pass the ID of the article as an argument to the controller action. This is less important for the category but it's something i want to do with the article-id since it's unique but the title might not be.
I have checked out Attribute Routing and looked through some Routing guides and questions but haven't found anything that lets me implement this functionality. I've just started using ASP.NET MVC so i haven't been able to look into anything too advanced.
Thanks in advance.
I would advice to make the article title unique and from the controller action you have to get the article based on the title.
I see you are trying to group the articles based on category. When I initially created my blog I thought the same-thing but soon realized it's not a flexible approach because of couple of reasons.
Say you wrote one article with name some-title and dropped it under a category say politics and so the url will be domain.com/politics/some-title but at a later point of time you thought to move the article to another category say 'international-politics' therefore your url now has to be changed to domain.com/international-politics/some-title and you break the old url and whoever has bookmarked that link will now receive 404. A better way would be organize the urls based on the posted date and that's not going to change something like http://domain.com/archive/yyyy/mm/dd/unique_title
Sometimes you want to label an article with more than one category and at that time a tag based approach will become a better choice compared to category based approach.
Quick and dirty solutions:
1) domain.com/categoryName/articleID/articleName/
2) domain.com/date/categoryName/articleName (date should help make articleName unique)
3) domain.com/categoryName/articleName?id=xxx
Nothing fancy, but those approaches will work.

Is the concept of a link inseparable from its html markup?

I'm looking for a strategy for managing links within articles. The body of the article is saved in a database and pulled during page assembly. What all should be saved in the database to easily define and manage links?
Some purists believe that markup should NEVER be stored in the database. Some believe its ok in moderation. But to me, the notion of a link is almost inseparable from its html markup.
Is there a better, more succinct way of representing a link in an article (in a database) than simply embedding "anchor text"?
One idea I've kicked around involves embedding just enough markup to semantically describe areas of interest, and in a different table, map those notions to actual URLs. All encounters of a particular notion get wrapped with the link.
<p>Here is an example of a
<span class="external-reference semantic-web">semantic</span>
approach to link management.</p>
A table then might associate the URL of the article and the key class of 'semantic-web' to a URL like http://en.wikipedia.org/wiki/Semantic_Web
<p>Here is an example of a <span class="external-reference semantic-web">
semantic</span>
approach to link management.</p>
Things I like about this approach is that all my URLs are in one location in the database. I could technically change or remove links without touching the body of the article. I have very good class names for CSS.
I don't like having another table to maintain, and another step/phase in render time. It could slow down response time.
Are there any other strategies out there that provide superior link management?
You may want to look at templating (such as Smarty for PHP).
I agree that markup shouldn't normally be held in the database.
However, you might also consider implementing a "pointer" concept, where at each link, you break your storage of the page, add a pointer in the table to the link, then a pointer in the link table to the next segment of content for the page. (I have no idea how complicated that would be - just an idea.)
Or look at how various CMS tools handle the idea. Some just put everything in the database as one big block of text, while others rely on templating, and others may do something else entirely (like object-oriented environments such as Plone).
There are a few attempts to do this that I have seen.
One way to do this is through URL redirects. You can implement a logic component on the server that will interpretate what the URL is requesting rather than a path to the content.
Another attempt is that the links orginally set to a reference value [which can be looked up in a database], and is requested at runtime/generation.
Regardless, you will have to reference the material that you wish to link to with some sort of identifier.

Resources