Skip to content

Commit 2243497

Browse files
authored
Merge pull request #37 from iazaran/feature/seo
Feature/seo
2 parents 4c455d3 + 4973496 commit 2243497

File tree

9 files changed

+96
-15
lines changed

9 files changed

+96
-15
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
#### Features:
1010
**List of features related with structure**
1111
- **public**
12-
Contains the index.php file, to start application and configures auto-loading. Different server configurations added into this directory too. Finally, you can find the Sitemap generator that run after creation or updating a post.
12+
Contains the index.php file, to start application and configures auto-loading. Different server configurations added into this directory too. Finally, you can find the Sitemap generator that runs after creation or updating a post.
1313
- **public/assets**
1414
Assets can contain your media files like images, audios & videos.
1515
- **public/css** & **public/js**
1616
Contains the styles & scripts _(After changes on these files, you can use minifier script to update minified versions, just run `docker-compose exec php-mvc-app php minifier.php`)_
1717
- **public/feed**
18-
There is a RSS generator in here and run after creation or updating a post.
18+
There is a RSS generator in here and runs after creation or updating a post.
1919
- **src**
2020
Contains migrations for a DB and routes.
2121
- **src/App**
@@ -58,7 +58,7 @@ Check Cross-site request forgery token
5858
- **Helper::slug(...)**
5959
Slugify string to make user-friendly URL
6060
- **Cache::checkCache(...)**, **Cache::cache(...)** & **Cache::clearCache(...)**
61-
Check existed cache, cache data and clear cache, by Memcached
61+
Check existing cache, cache data and clear cache, by Memcached
6262
- **UserInfo::current()**
6363
Return current user information
6464
- **UserInfo::info(...)**

public/assets/images/banner.png

147 KB
Loading

public/assets/images/logo.png

36.2 KB
Loading

public/sitemap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* This script can produce a sitemap.xml in public folder
5-
* This one call by XmlGenerator::feed() function after
5+
* That called by XmlGenerator::feed() function after
66
* each post creation or updating
77
*/
88

src/Console/commands.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
];
3131

3232
/**
33-
* Add script to current one to run it
33+
* Run script if existed and match with timing
3434
*/
3535
foreach ($commands as $k => $v) {
3636
if ($timingMapping[$v]) {

src/Controllers/AuthController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function registerForm()
2929
'Auth/register',
3030
[
3131
'page_title' => 'Register',
32-
'page_subtitle' => 'Register to send post in Blog'
32+
'page_subtitle' => 'Register to send post in Blog',
3333
]
3434
);
3535
}
@@ -96,7 +96,7 @@ public function verify()
9696
'Auth/verify',
9797
[
9898
'page_title' => 'Email Verification',
99-
'page_subtitle' => 'Verification process failed! Please register again with a new email address.'
99+
'page_subtitle' => 'Verification process failed! Please register again with a new email address.',
100100
]
101101
);
102102
}
@@ -118,7 +118,7 @@ public function loginForm()
118118
'Auth/login',
119119
[
120120
'page_title' => 'Login',
121-
'page_subtitle' => 'Login to send post in Blog'
121+
'page_subtitle' => 'Login to send post in Blog',
122122
]
123123
);
124124
}

src/Controllers/BlogController.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ public function index()
3131
[
3232
'page_title' => 'Blog',
3333
'page_subtitle' => 'Basic PHP MVC | Blog',
34+
'page_type' => 'article',
3435

35-
'posts' => $posts
36+
'posts' => $posts,
3637
]
3738
);
3839
}
@@ -53,8 +54,10 @@ public function show(string $slug)
5354
[
5455
'page_title' => $post['title'],
5556
'page_subtitle' => $post['subtitle'],
57+
'page_type' => 'article',
58+
'page_banner' => '/assets/images/' . Helper::slug($post['title'], '-', false) . '.jpg',
5659

57-
'post' => $post
60+
'post' => $post,
5861
]
5962
);
6063
}
@@ -75,7 +78,8 @@ public function create()
7578
'Blog/create',
7679
[
7780
'page_title' => 'Create Post',
78-
'page_subtitle' => 'Create new post in Blog'
81+
'page_subtitle' => 'Create new post in Blog',
82+
'page_type' => 'article',
7983
]
8084
);
8185
}
@@ -138,8 +142,9 @@ public function edit(string $slug)
138142
[
139143
'page_title' => 'Edit ' . $post['title'],
140144
'page_subtitle' => $post['subtitle'],
145+
'page_type' => 'article',
141146

142-
'post' => $post
147+
'post' => $post,
143148
]
144149
);
145150
}

src/Views/Include/footer.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,59 @@
2020
<script>
2121
const apiAddress = '<?= URL_ROOT; ?>';
2222
</script>
23+
24+
<!-- LD JSON -->
25+
<script type="application/ld+json">
26+
{
27+
"@context": "https://schema.org/",
28+
"@type": "Corporation",
29+
"name": "GiliApps",
30+
"legalName" : "GiliApps",
31+
"url": "<?= URL_ROOT; ?>",
32+
"logo": "<?= URL_ROOT; ?>/assets/images/logo.png",
33+
"foundingDate": "2014-01-10",
34+
"founders": [
35+
{
36+
"@type": "Person",
37+
"name": "Ismael Azaran"
38+
} ],
39+
"address": {
40+
"@type": "PostalAddress",
41+
"streetAddress": "7035 Balmoral St, Burnaby",
42+
"addressLocality": "Vancouver",
43+
"addressRegion": "BC",
44+
"postalCode": "V5E 1J4",
45+
"addressCountry": "Canada"
46+
},
47+
"geo": {
48+
"@type": "GeoCoordinates",
49+
"longitude": "-122.9587149",
50+
"latitude": "49.22043"
51+
},
52+
"hasMap": "https://www.google.com/maps/place/Giliapps/@49.22043,-122.9587149,15z/data=!4m2!3m1!1s0x0:0x7c4b556928c54c6b?sa=X&ved=0ahUKEwiYxKWQ1ejVAhWQZpoKHai5AdAQ_BIIoAEwEg",
53+
"openingHours": "Mo 09:00-18:00 Tu 09:00-18:00 We 09:00-18:00 Th 09:00-18:00 Fr 09:00-18:00 Sa Closed Su Closed",
54+
"contactPoint": {
55+
"@type": "PostalAddress",
56+
"contactType": "Support",
57+
"telephone": "[+1-778-806-1308]"
58+
},
59+
"sameAs": [
60+
"https://www.instagram.com/giliapps",
61+
"https://twitter.com/Giliapps",
62+
"https://www.facebook.com/Giliapps",
63+
"http://www.linkedin.com/company/giliapps",
64+
"https://www.pinterest.com/giliapps",
65+
"http://www.youtube.com/user/Giliapps",
66+
"http://giliapps.tumblr.com",
67+
"https://foursquare.com/v/giliapps/5412e16f498e0e4501f1cdb2",
68+
"http://vimeo.com/giliapps",
69+
"https://github.com/Giliapps",
70+
"https://codepen.io/Giliapps",
71+
"http://weheartit.com/giliapps"
72+
]
73+
}
74+
</script>
75+
2376
<script src="/js/main.min.js"></script>
2477
</body>
2578

src/Views/Include/header.php

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,42 @@
99
<meta name="title" content="<?= TITLE . ' ⦿ ' . $data['page_title']; ?>">
1010
<meta name="description" content="<?= $data['page_subtitle']; ?>">
1111
<meta name="author" content="<?= TITLE; ?>">
12-
<meta name="copyright"
13-
content="Copyright © <?= DATE('Y'); ?> | All rights reserved. Developed with 🖤 by <?= TITLE; ?>">
12+
<meta name="copyright" content="Copyright © <?= DATE('Y'); ?> | All rights reserved. Developed with 🖤 by <?= TITLE; ?>">
1413

14+
<meta property="og:url" content="<?= URL_ROOT . $_SERVER['REQUEST_URI']; ?>">
1515
<meta property="og:title" content="<?= TITLE . ' ⦿ ' . $data['page_title']; ?>">
1616
<meta property="og:description" content="<?= $data['page_subtitle']; ?>">
17+
<meta property="og:image" content="<?= URL_ROOT . ($data['page_banner'] ?? '/assets/images/banner.png'); ?>">
18+
<meta property="og:image:url" content="<?= URL_ROOT . ($data['page_banner'] ?? '/assets/images/banner.png'); ?>">
19+
<meta property="og:image:secure_url" content="<?= URL_ROOT . ($data['page_banner'] ?? '/assets/images/banner.png'); ?>">
1720
<meta property="og:site_name" content="<?= TITLE; ?>">
21+
<meta property="og:type" content="<?= $data['page_type'] ?? 'website'; ?>">
22+
<meta property="og:locale" content="en_US">
23+
24+
<?php
25+
if (isset($data['page_type']) && $data['page_type'] == 'article') {
26+
?>
27+
<meta property="article:published_time" content="<?= date(DATE_ATOM) ?>">
28+
<meta property="article:tag" content="php,mvc">
29+
<meta property="article:author" content="GiliApps">
30+
<?php
31+
}
32+
?>
1833

1934
<meta itemprop="name" content="<?= TITLE; ?>">
2035
<meta itemprop="headline" content="<?= TITLE . ' ⦿ ' . $data['page_title']; ?>">
2136
<meta itemprop="description" content="<?= $data['page_subtitle']; ?>">
37+
<meta itemprop="image" content="<?= URL_ROOT . ($data['page_banner'] ?? '/assets/images/banner.png'); ?>">
38+
<meta itemprop="thumbnailUrl" content="<?= URL_ROOT . ($data['page_banner'] ?? '/assets/images/banner.png'); ?>">
2239

40+
<meta name="twitter:url" content="<?= URL_ROOT . $_SERVER['REQUEST_URI']; ?>">
2341
<meta name="twitter:title" content="<?= TITLE . ' ⦿ ' . $data['page_title']; ?>">
2442
<meta name="twitter:description" content="<?= $data['page_subtitle']; ?>">
43+
<meta name="twitter:image" content="<?= URL_ROOT . ($data['page_banner'] ?? '/assets/images/banner.png'); ?>">
44+
<meta name="twitter:image:alt" content="<?= TITLE . ' ⦿ ' . $data['page_title']; ?>">
45+
<meta name="twitter:site" content="@giliapps">
46+
<meta name="twitter:site:id" content="@giliapps">
47+
<meta name="twitter:creator" content="@giliapps">
2548
<meta name="twitter:card" content="summary_large_image">
2649

2750
<!-- Favicon generated by https://realfavicongenerator.net/ -->
@@ -96,4 +119,4 @@
96119
<?php } ?>
97120
</ul>
98121
</div>
99-
</nav>
122+
</nav>

0 commit comments

Comments
 (0)