Skip to content

Commit 1cc6215

Browse files
pReyatexnixe
authored andcommitted
fix: uncommon whitespace characters
1 parent e1afcca commit 1cc6215

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

content/docs/3_cookbook/0_development-deployment/0_shared-controllers/cookbook-recipe.txt

+36-36
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ We'll use the `<title>` and `<meta name="description">` tags as an example. The
3939
<html>
4040
<head>
4141

42-
  <!-- The title tag shows the title of our site and the title of the current page -->
43-
  <title><?= $site->title() ?> | <?= $page->title() ?></title>
44-
  
45-
  <!-- The meta description shows an excerpt of the main text -->
46-
  <meta name="description" content="<?= $page->text()->excerpt(120) ?>">
42+
<!-- The title tag shows the title of our site and the title of the current page -->
43+
<title><?= $site->title() ?> | <?= $page->title() ?></title>
44+
45+
<!-- The meta description shows an excerpt of the main text -->
46+
<meta name="description" content="<?= $page->text()->excerpt(120) ?>">
4747
</head>
4848
```
4949

@@ -54,11 +54,11 @@ That's a perfectly fine and reasonable solution. But what if we want to show a s
5454
<html>
5555
<head>
5656

57-
  <!-- The title tag shows the title of our site and the title of the current page -->
58-
  <title><?php e($page->isHomePage() , $site->title() . "|" . $site->tagline() , $site->title() . "|" . $page->title()) ?></title>
59-
  
60-
  <!-- The meta description shows an excerpt of the main text -->
61-
  <meta name="description" content="<?= $page->text()->excerpt(120) ?>">  
57+
<!-- The title tag shows the title of our site and the title of the current page -->
58+
<title><?php e($page->isHomePage() , $site->title() . "|" . $site->tagline() , $site->title() . "|" . $page->title()) ?></title>
59+
60+
<!-- The meta description shows an excerpt of the main text -->
61+
<meta name="description" content="<?= $page->text()->excerpt(120) ?>">  
6262

6363
</head>
6464
```
@@ -75,13 +75,13 @@ The first thing we need to do is set up our default controller. To do that we'll
7575
<?php
7676

7777
return function ($page, $pages, $site, $kirby) {
78-
    
79-
  # Fetch and store the content for the title tag and the meta description
80-
  $titleTag        = $site->title() . " | " . $page->title();
81-
  $metaDescription = $page->text()->excerpt(120);
82-
    
83-
  # Return an array containing the data that we want to pass to the template
84-
  return compact('titleTag' , 'metaDescription');
78+
79+
# Fetch and store the content for the title tag and the meta description
80+
$titleTag = $site->title() . " | " . $page->title();
81+
$metaDescription = $page->text()->excerpt(120);
82+
83+
# Return an array containing the data that we want to pass to the template
84+
return compact('titleTag' , 'metaDescription');
8585

8686
};
8787
```
@@ -92,12 +92,12 @@ Now that the logic to fetch the correct data has been moved inside the controlle
9292
<!DOCTYPE html>
9393
<html>
9494
<head>
95-
    
96-
  <!-- The title tag we show the title of our site and the title of the current page -->
97-
  <title><?= $titleTag ?></title>
9895

99-
  <!-- The meta description shows an excerpt of the main text -->
100-
  <meta name="description" content="<?= $metaDescription ?>">
96+
<!-- The title tag we show the title of our site and the title of the current page -->
97+
<title><?= $titleTag ?></title>
98+
99+
<!-- The meta description shows an excerpt of the main text -->
100+
<meta name="description" content="<?= $metaDescription ?>">
101101

102102
</head>
103103
<body>
@@ -109,12 +109,12 @@ Excellent, this is already looking a lot cleaner. Now we need to implement the d
109109
<?php
110110

111111
return function ($page, $pages, $site, $kirby) {
112-
    
112+
113113
  # Store the content for the different title tag
114-
  $titleTag = $site->title() . " | " . $site->tagline();
115-
    
114+
$titleTag = $site->title() . " | " . $site->tagline();
115+
116116
  # Return the array containing the data that we want to pass to the template
117-
  return compact('titleTag');
117+
return compact('titleTag');
118118

119119
};
120120
```
@@ -164,15 +164,15 @@ The final `home.php` controller will look like this:
164164
<?php
165165

166166
return function ($page, $pages, $site, $kirby) {
167-
    
167+
168168
  # Grab the data from the default controller
169-
  $shared = $kirby->controller('site' , compact('page', 'pages', 'site', 'kirby'));
169+
$shared = $kirby->controller('site' , compact('page', 'pages', 'site', 'kirby'));
170170

171171
  # Fetch and store the content for the different title tag
172-
  $titleTag = $site->title() . " | " . $site->tagline();
173-
    
172+
$titleTag = $site->title() . " | " . $site->tagline();
173+
174174
  # Return the array containing the data that we want to pass to the template
175-
  return A::merge($shared , compact('titleTag'));
175+
return A::merge($shared , compact('titleTag'));
176176

177177
};
178178
```
@@ -201,15 +201,15 @@ To do that you need to pass the correct controller name to the `controller()` fu
201201
<?php
202202

203203
return function ($page, $pages, $site, $kirby) {
204-
    
204+
205205
  # Grab the data from the post.php controller
206-
  $post = $kirby->controller('post' , compact('page', 'pages', 'site', 'kirby'));
206+
$post = $kirby->controller('post' , compact('page', 'pages', 'site', 'kirby'));
207207

208208
  # Custom content for the video post
209-
  $video = $page->videourl();
210-
    
209+
$video = $page->videourl();
210+
211211
  # Return the array containing the data that we want to pass to the template
212-
  return A::merge($post , compact('video'));
212+
return A::merge($post , compact('video'));
213213

214214
};
215215
```

0 commit comments

Comments
 (0)