Skip to content

Commit

Permalink
Optimizing page titles.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuswilms committed Sep 14, 2014
1 parent 81288ec commit 69a7eae
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions views/api_browser/view.html.php
Expand Up @@ -2,7 +2,14 @@

$scope = strtok($object['identifier'], '\\') . '_docs';
$namespace = str_replace('\\', '/', $name);
$this->title($namespace);

$title = $namespace;
if ($object['text'] && preg_match('/^# ([\w\s\:]+)$/m', $object['text'], $matches)) {
$title = $matches[1];
} elseif (strpos($name, '.md') === false && strpos($name, '/') === false) {
$title = $name;
}
$this->title($title . ' – ' . $object['library'] . ' – ' . 'docs');

$params = isset($object['tags']['params']) && !empty($object['tags']['params']);
$return = isset($object['return']) && !empty($object['return']);
Expand Down Expand Up @@ -39,7 +46,7 @@
?>

<article class="view-<?= $this->_config['controller'] . '-' . $this->_config['template'] ?> has-aside-right">
<?php if (strpos($name, '.md') === false && $object['type'] !== 'namespace'): ?>
<?php if ($title && $object['type'] !== 'namespace'): ?>
<h1 class="h-alpha"><?= $name ?></h1>
<?php endif ?>
<?php if ($meta) { ?>
Expand Down

0 comments on commit 69a7eae

Please sign in to comment.