The Era of Modern Websites
Presented By:
Piyush Agarwal
"Remember the parable about the man who built his house on sand? Or the pigs who made their houses out of straw and sticks?
LOSERS
They lost because they didn't put enough value on the importance of STRUCTURE"
as cited by Peter Gasston in his book 'The Modern Web'
Structure before Semantics
- Structure is the most important feature of a website and on the Web it starts with the use of good HTML
- The ways one marks-up his web pages gives them a solid structure both now and in the future
- A Solid structure, makes your website more accessible and easy to manage and maintain
Example

Semantics
- Beyond simple structure lies the richness of a good Semantic;
- Semantic means to give your web page content an extra meaning which is very beneficial;
- Some benefits of Semantics include:
- Better understanding of the page for anyone
- Easier for search-engines to crawl and understand your data
- Long-term benefits, which are still hidden
- The Semantic Web is a collaborative movement led by international standards body the World Wide Web Consortium (W3C) which promotes common data formats on the World Wide Web.
- By encouraging the inclusion of semantic content in web pages, the Semantic Web aims at converting the current web, dominated by unstructured and semi-structured documents into a "web of data".
- The Semantic Web stack builds on the W3C's Resource Description Framework (RDF).
citation - Wikipedia: Semantic Web
Resource Description Framework (RDF)
- RDF is a family of W3C specifications which was originally designed as a metadata data model.
- It has come to be used as a general method for conceptual description or modeling of information that is implemented in web resources, using a variety of syntax notations and data serialization formats.
- RDF is based upon the idea of making statements about the resource, especially web-resource, in the form of subject-predicate-object expressions
RDF (Contd...)
- Subject denotes the resource; Predicate denotes traits or aspects of the resource and expresses a relationship between the Subject and the Object .
- Example - one way to represent the notion "The basket-ball is round in shape" in RDF is as the triple: a subject denoting "the basket-ball", a predicate denoting "the shape", and an object denoting "round".
- The same example above can also be represented in the classical notation of entity-attribute-value model as entity (basket-ball), attribute (shape) and value (round).
- The RDF Vocabulary
Importance of Semantics
"Our boat is safely anchored by the shore,
And there will safely ride when we are gone;
The flowering shrubs that deck our humble door
Will prosper, though untended and alone:
Fields, goods, and far-off chattels we have none:
These narrow bounds contain our private store
Of things earth makes, and sun doth shine upon;
Here are they in our sight--we have no more."
-William Wordsworth - A Farewell
- We know that the above is a paragraph from the poem 'A Farewell' but the search engine does not knows it because the word Farewell is never mentioned in the paragraph.
Semantics with HTML
- Created by Grassroots Coalition of Developers
- Add extra meaning to content through standardized markup patterns using existing HTML attributes
-
Example:
<div class="vcard">
<p><a href="https://www.facebook.com/piyushagarwal11" class="url fn">Piyush Agarwal</a>
is a student at <a href="http://uncg.edu" class="url org">UNCG</a>.</p>
</div> -
A crawler which recognizes the hcard pattern will see the vcard class and know that the content inside is the information for the person it is looking for. First link contains the full name(fn) of the contact and the second link contains the organization(org) the contact is related to
Semantics with HTML(Contd...)
- Is an extension of HTML which provides context to content using a whole new set of attributes.
- Relies on a predefined schema to describe the content.
- Example:
- The value of the attribute is the URL of the relevant description of the term "creator" from a schema which is part of a standardized vocabulary known as Dublin Core.
<p property="http://purl.org/dc/elements/1.1/creator">Piyush Agarwal</p>
Semantics with HTML5
- HTML5 has addressed the semantic issue with the creation of a simple syntax called the Microdata.
- A series of name-value pairs that provide meaningful machine-readable data
- Example:
- We can test our semantic on the Google's Structured Data Testing Tool.
<p itemscope>Hello, my name is <span itemprop="given-name">Piyush</span>
and I'm<span itemprop="role"> a student</span> at <span itemprop="university">UNCG</span>.
</p>
Microdata API
- It has a companion DOM API which proves useful for extracting the data from the page
- getItems() is the key method which returns a NodeList containing all items on the page
var list = document.getItems();
var itemVal = list[0].properties['name'][0].itemValue;
NOTE: As there were still many issues with this API, Google has removed it from Chrome
What should I use?
-
One can use any of the three Semantic types, which he/she is comfortable with, but my preference is Microdata.
- The reason for this preference is that it is widely accepted on Web so one can get the web page content easily noticed and promoted by search engines.
- In 2011 four big Web Giants - Google, Microsoft, Yahoo! and Yandex - launched a new Website, Schema.org, which introduced a set of shared vocabularies for marking up common patterns using microdata.
Data Attributes
- Acts as key-value pairs as in Databases
- There is a key attached to a value displayed on the page.
<p data-id="123">DevTalks</p>
- Gives no extra meaning to the machines or humans, but it can be used in scripts for reference
Using Data Attributes in Scripts
- Simple DOM API that uses the dataset property
var temp = document.querySelector('p');
console.log('The ID is ', temp.dataset['id']);
temp.dataset['id'] = 100;
console.log('New ID is ', temp.dataset['id']);
- Some companies like Twitter, Facebook, Google+, etc. have already started using data attributes extensively
- Twitter adopted them quickly, allowing them to be used for adding tweet button on webpages
<a href="https://twitter.com/share" class="twitter-share-button" data-url="https://uncg.edu" data-via="piyushag88">Tweet</a>
By calling to Twitter's JavaScript somewhere else in the page, this element is replaced by a Tweet Button
Device-Scalable Websites using CSS
- The websites should be Adaptive and Responsive
- We can make our websites both adaptive and responsive using the media queries provided in CSS
- Table based websites are now an old practice with the rapid development in CSS
- Media Query is a logical statement: if the logic is True, the specified style rules are applied; if the logic is False, these rules are skipped
- The most common use of this is the use of device dimensions or the viewport
Media Queries
-
This specifies that the media type should be a screen (not a printer) and if the query is true then apply the style-sheet test.css<link rel="stylesheet" href="test.css" media="screen and (query)"> -
This specifies the inline method of using media queries in a CSS file@media screen and (query) {...} -
This is used when we need to import one CSS into another CSS file, based on the query@import url('test.css') screen and (query);
Working with various Dimensions?
-
Different type of dimensions:
- Device - The dimensions of the device being used, i.e., the monitor, smartphone, TV, etc.
- Viewport - The dimensions of the area in which the website is being displayed, i.e., browser window size, app window, etc.
- Which one of the two is important?
Predefined CSS Frameworks
- To ease out the task of coding, there are some predefined CSS frameworks available
- The best of them is Bootstrap
- Bootstrap provides some predefined templates and ways in which we can make our websites more device responsive and adaptive
Enough of lecture and Theory...
Lets see what we learnt till now with some examples
Conclusion
- A well-structured web page makes it easy to maintain it
- Semantics provide better meaning to the webpage
- We can use RDF, Microformat, RDFa and Microdata for providing Semantic to our web-content. Data-Attributes can be used to help the developers in getting hidden-values in scripts
- CSS can help make our websites Adaptive and Responsive
- Media Queries is one of the best feature provided in CSS to apply rules based on some queries
- We can use the modern CSS frameworks like Bootstrap for making websites adaptive and responsive, EASY
The Era of Modern Websites
By Piyush Agarwal
The Era of Modern Websites
An Introduction to the latest changes in Website Development; Introduction to Semantic Web; Creating Device Scalable Websites using CSS.
- 2,924