Browse Source

Use schema.org for breadcrumb

Cleaning up the breadcrumb
pull/400/head
danpros 5 years ago
parent
commit
c8552f3c37
2 changed files with 19 additions and 19 deletions
  1. +16
    -16
      system/htmly.php
  2. +3
    -3
      system/includes/functions.php

+ 16
- 16
system/htmly.php View File

@ -394,7 +394,7 @@ get('/front/edit', function () {
} }
}); });
// Show the "Add post" page
// Show the "Add content" page
get('/add/content', function () { get('/add/content', function () {
$req = $_GET['type']; $req = $_GET['type'];
@ -412,7 +412,7 @@ get('/add/content', function () {
'type' => $type, 'type' => $type,
'is_admin' => true, 'is_admin' => true,
'bodyclass' => 'add-content', 'bodyclass' => 'add-content',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add post'
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add content'
)); ));
} else { } else {
$login = site_url() . 'login'; $login = site_url() . 'login';
@ -794,7 +794,7 @@ get('/add/category', function () {
'type' => 'is_category', 'type' => 'is_category',
'is_admin' => true, 'is_admin' => true,
'bodyclass' => 'add-category', 'bodyclass' => 'add-category',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add page'
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add category'
)); ));
} else { } else {
$login = site_url() . 'login'; $login = site_url() . 'login';
@ -841,7 +841,7 @@ post('/add/category', function () {
'type' => 'is_category', 'type' => 'is_category',
'is_admin' => true, 'is_admin' => true,
'bodyclass' => 'add-category', 'bodyclass' => 'add-category',
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add page'
'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Add category'
)); ));
} }
}); });
@ -1973,7 +1973,7 @@ get('/post/:name', function ($name) {
} }
if (config('blog.enable') === 'true') { if (config('blog.enable') === 'true') {
$blog = ' <span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . 'blog">Blog</a></span> &#187; ';
$blog = '<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="' . site_url() . 'blog"><span itemprop="name">Blog</span></a><meta itemprop="position" content="2" /></li> &#187; ';
} else { } else {
$blog = ''; $blog = '';
} }
@ -2010,7 +2010,7 @@ get('/post/:name', function ($name) {
'p' => $current, 'p' => $current,
'author' => $author, 'author' => $author,
'bodyclass' => 'in-post category-' . $current->ct . ' type-' . $current->type, 'bodyclass' => 'in-post category-' . $current->ct . ' type-' . $current->type,
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; '. $blog . '<span typeof="v:Breadcrumb">' . $current->categoryb . '</span>' . ' &#187; ' . $current->title,
'breadcrumb' => '<style>.breadcrumb-list {margin:0; padding:0;} .breadcrumb-list li {display: inline-block; list-style: none;}</style><ol class="breadcrumb-list" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="' . site_url() . '"><span itemprop="name">' . config('breadcrumb.home') . '</span></a><meta itemprop="position" content="1" /></li> &#187; '. $blog . '<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">' . $current->categoryb . '<meta itemprop="position" content="3" /></li>' . ' &#187; ' . $current->title . '</ol>',
'prev' => has_prev($prev), 'prev' => has_prev($prev),
'next' => has_next($next), 'next' => has_next($next),
'type' => $var, 'type' => $var,
@ -2062,7 +2062,7 @@ get('/post/:name/edit', function ($name) {
'type' => $type, 'type' => $type,
'is_admin' => true, 'is_admin' => true,
'bodyclass' => 'edit-post', 'bodyclass' => 'edit-post',
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
'breadcrumb' => '<span><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
)); ));
} else { } else {
render('denied', array( render('denied', array(
@ -2072,7 +2072,7 @@ get('/post/:name/edit', function ($name) {
'p' => $current, 'p' => $current,
'bodyclass' => 'denied', 'bodyclass' => 'denied',
'is_admin' => true, 'is_admin' => true,
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
'breadcrumb' => '<span><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
)); ));
} }
} else { } else {
@ -2254,7 +2254,7 @@ get('/post/:name/delete', function ($name) {
'p' => $current, 'p' => $current,
'is_admin' => true, 'is_admin' => true,
'bodyclass' => 'delete-post', 'bodyclass' => 'delete-post',
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
'breadcrumb' => '<span><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
)); ));
} else { } else {
render('denied', array( render('denied', array(
@ -2264,7 +2264,7 @@ get('/post/:name/delete', function ($name) {
'p' => $current, 'p' => $current,
'is_admin' => true, 'is_admin' => true,
'bodyclass' => 'delete-post', 'bodyclass' => 'delete-post',
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
'breadcrumb' => '<span><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
)); ));
} }
} else { } else {
@ -2957,7 +2957,7 @@ get('/:year/:month/:name', function ($year, $month, $name) {
} }
if (config('blog.enable') === 'true') { if (config('blog.enable') === 'true') {
$blog = ' <span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . 'blog">Blog</a></span> &#187; ';
$blog = '<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="' . site_url() . 'blog"><span itemprop="name">Blog</span></a><meta itemprop="position" content="2" /></li> &#187; ';
} else { } else {
$blog = ''; $blog = '';
} }
@ -2994,7 +2994,7 @@ get('/:year/:month/:name', function ($year, $month, $name) {
'p' => $current, 'p' => $current,
'author' => $author, 'author' => $author,
'bodyclass' => 'in-post category-' . $current->ct . ' type-' . $current->type, 'bodyclass' => 'in-post category-' . $current->ct . ' type-' . $current->type,
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; '. $blog . '<span typeof="v:Breadcrumb">' . $current->categoryb . '</span>' . ' &#187; ' . $current->title,
'breadcrumb' => '<style>.breadcrumb-list {margin:0; padding:0;} .breadcrumb-list li {display: inline-block; list-style: none;}</style><ol class="breadcrumb-list" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="' . site_url() . '"><span itemprop="name">' . config('breadcrumb.home') . '</span></a><meta itemprop="position" content="1" /></li> &#187; '. $blog . '<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">' . $current->categoryb . '<meta itemprop="position" content="3" /></li>' . ' &#187; ' . $current->title . '</ol>',
'prev' => has_prev($prev), 'prev' => has_prev($prev),
'next' => has_next($next), 'next' => has_next($next),
'type' => $var, 'type' => $var,
@ -3046,7 +3046,7 @@ get('/:year/:month/:name/edit', function ($year, $month, $name) {
'type' => $type, 'type' => $type,
'bodyclass' => 'edit-post', 'bodyclass' => 'edit-post',
'is_admin' => true, 'is_admin' => true,
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
'breadcrumb' => '<span><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
)); ));
} else { } else {
render('denied', array( render('denied', array(
@ -3056,7 +3056,7 @@ get('/:year/:month/:name/edit', function ($year, $month, $name) {
'p' => $current, 'p' => $current,
'bodyclass' => 'denied', 'bodyclass' => 'denied',
'is_admin' => true, 'is_admin' => true,
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
'breadcrumb' => '<span><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
)); ));
} }
} else { } else {
@ -3238,7 +3238,7 @@ get('/:year/:month/:name/delete', function ($year, $month, $name) {
'p' => $current, 'p' => $current,
'bodyclass' => 'delete-post', 'bodyclass' => 'delete-post',
'is_admin' => true, 'is_admin' => true,
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
'breadcrumb' => '<span><a rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
)); ));
} else { } else {
render('denied', array( render('denied', array(
@ -3248,7 +3248,7 @@ get('/:year/:month/:name/delete', function ($year, $month, $name) {
'p' => $current, 'p' => $current,
'bodyclass' => 'delete-post', 'bodyclass' => 'delete-post',
'is_admin' => true, 'is_admin' => true,
'breadcrumb' => '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
'breadcrumb' => '<span><a href="' . site_url() . '">' . config('breadcrumb.home') . '</a></span> &#187; ' . $current->tagb . ' &#187; ' . $current->title
)); ));
} }
} else { } else {


+ 3
- 3
system/includes/functions.php View File

@ -268,13 +268,13 @@ function get_posts($posts, $page = 1, $perpage = 0)
if($str[count($str) - 3] == 'uncategorized') { if($str[count($str) - 3] == 'uncategorized') {
$category = default_category(); $category = default_category();
$post->category = '<a href="' . $category->url . '">' . $category->title . '</a>'; $post->category = '<a href="' . $category->url . '">' . $category->title . '</a>';
$post->categoryb = '<a property="v:title" rel="v:url" href="' . $category->url . '">' . $category->title . '</a>';
$post->categoryb = '<a itemprop="item" href="' . $category->url . '"><span itemprop="name">' . $category->title . '</span></a>';
} else { } else {
foreach ($catC as $k => $v) { foreach ($catC as $k => $v) {
if ($v['0'] === $str[count($str) - 3]) { if ($v['0'] === $str[count($str) - 3]) {
$post->category = '<a href="' . site_url() . 'category/' . $v['0'] . '">' . $v['1'] . '</a>'; $post->category = '<a href="' . site_url() . 'category/' . $v['0'] . '">' . $v['1'] . '</a>';
$post->categoryb = '<a property="v:title" rel="v:url" href="' . site_url() . 'category/' . $v['0'] . '">' . $v['1'] . '</a>';
$post->categoryb = '<a itemprop="item" href="' . site_url() . 'category/' . $v['0'] . '"><span itemprop="name">' . $v['1'] . '</span></a>';
} }
} }
@ -343,7 +343,7 @@ function get_posts($posts, $page = 1, $perpage = 0)
foreach ($tag as $a) { foreach ($tag as $a) {
$url[] = '<a rel="tag" href="' . $a[1] . '">' . $a[0] . '</a>'; $url[] = '<a rel="tag" href="' . $a[1] . '">' . $a[0] . '</a>';
$bc[] = '<span typeof="v:Breadcrumb"><a property="v:title" rel="v:url" href="' . $a[1] . '">' . $a[0] . '</a></span>';
$bc[] = '<span><a href="' . $a[1] . '">' . $a[0] . '</a></span>';
} }
$post->tag = implode(' ', $url); $post->tag = implode(' ', $url);


Loading…
Cancel
Save