Skip to content

Instantly share code, notes, and snippets.

@deckool
Created July 28, 2016 14:19
Show Gist options
  • Save deckool/e456d7d92cf95ddaaceda0259f94460f to your computer and use it in GitHub Desktop.
Save deckool/e456d7d92cf95ddaaceda0259f94460f to your computer and use it in GitHub Desktop.
article page RDFa ready parsed for blaze-html
{-# LANGUAGE OverloadedStrings #-}
import Prelude
import qualified Prelude as P
import Data.Monoid (mempty)
import Text.Blaze.Html5
import qualified Text.Blaze.Html5 as H
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5.Attributes as A
articleType :: Html
articleType = do
body ! vocab "http://schema.org/" $ do
"..."
H.div ! property "breadcrumb" $ do
a ! href "http://www.ibm.com/developerworks/" $ "IBM developerWorks"
">"
a ! href "http://www.ibm.com/developerworks/web/" $ "Web development"
">"
a ! href "http://www.ibm.com/developerworks/views/web/library.jsp" $ "Technical library"
H.div ! typeof "Article" $ do
H.div ! property "image" ! typeof "ImageObject" $ do
link ! property "url" ! href "image.jpg"
meta ! property "height" ! content "50"
meta ! property "width" ! content "50"
link ! property "publisher" ! href "#Organization"
H.div ! property "name headline" $ "An introduction to RDF"
p ! property "author" ! resource "#uche.ogbuji" ! typeof "Person" $ do
"by"
H.span ! property "name" $ "Uche Ogbuji"
","
H.span ! property "jobTitle" $ "Partner"
","
H.span ! property "worksFor" $ "Zepheira"
"."
H.div ! vocab "http://schema.org/" ! resource "#Organization" ! typeof "Organization" $ do
H.span ! property "name" $ "L'Amourita Pizza"
"Located at"
H.div ! property "address" ! typeof "PostalAddress" $ do
H.span ! property "streetAddress" $ "123 Main St"
","
H.span ! property "addressLocality" $ "Albuquerque"
","
H.span ! property "addressRegion" $ "NM"
"."
H.div ! property "logo" ! typeof "imageobject" $ img ! property "url" ! src "http://example.com"
"Phone:"
H.span ! property "telephone" $ "206-555-1234"
a ! href "http://pizza.example.com/" ! property "url" $ "http://pizza.example.com"
H.div $ do
"Published:"
H.span ! property "datePublished dateModified" $ "01 Dec 2000"
H.div ! property "description" $ do
b "Summary"
": This article introduces Resource Description Framework (RDF),\n developed by the W3C for Web-based metadata, using XML as an interchange syntax.\n RDF's essential aim is to make work easier for autonomous agents, \n which would refine the Web by improving search engines and service directories. \n Author Uche Ogbuji gives an overview of RDF aspects from schemas to usage scenarios.\n The article assumes that you are already familiar with XML."
H.div $ do
"Tags for this article:"
H.span ! property "keywords" $ "introduction"
","
H.span ! property "keywords" $ "rdf"
","
H.span ! property "keywords" $ "tutorial"
"."
H.div ! property "mainEntityOfPage" $ "This article's texts is suitable for a wide audience, with a Fog index of."
"..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment