mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-09-30 05:09:11 +02:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
794778ae20 | ||
|
05e6963f04 | ||
|
3f75c06a77 | ||
|
a13d3dd9de | ||
|
59acd419ef | ||
|
aeeb960566 | ||
|
c7f260bb33 | ||
|
c2f5162e97 | ||
|
59e56c3b69 | ||
|
d9da059a83 | ||
|
54ddc6ccf7 | ||
|
cbccf88a62 | ||
|
8a7c8aa9cc | ||
|
def6be347c | ||
|
523d196d12 | ||
|
f064330acd | ||
|
f1bddb626d | ||
|
77a366871e | ||
|
81b8d870a4 | ||
|
9b0e0f1064 | ||
|
7370c85dae | ||
|
bf6156c103 | ||
|
35665402cb |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,4 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
/vendor
|
||||||
|
/public
|
||||||
|
/composer.lock
|
||||||
|
@ -1,69 +0,0 @@
|
|||||||
inherit: true
|
|
||||||
|
|
||||||
checks:
|
|
||||||
php:
|
|
||||||
verify_property_names: true
|
|
||||||
verify_argument_usable_as_reference: true
|
|
||||||
verify_access_scope_valid: true
|
|
||||||
useless_calls: true
|
|
||||||
use_statement_alias_conflict: true
|
|
||||||
variable_existence: true
|
|
||||||
unused_variables: true
|
|
||||||
unused_properties: true
|
|
||||||
unused_parameters: true
|
|
||||||
unused_methods: true
|
|
||||||
unreachable_code: true
|
|
||||||
too_many_arguments: true
|
|
||||||
sql_injection_vulnerabilities: true
|
|
||||||
simplify_boolean_return: true
|
|
||||||
side_effects_or_types: true
|
|
||||||
security_vulnerabilities: true
|
|
||||||
return_doc_comments: true
|
|
||||||
return_doc_comment_if_not_inferrable: true
|
|
||||||
require_scope_for_properties: true
|
|
||||||
require_scope_for_methods: true
|
|
||||||
require_php_tag_first: true
|
|
||||||
psr2_switch_declaration: true
|
|
||||||
psr2_class_declaration: true
|
|
||||||
property_assignments: true
|
|
||||||
prefer_while_loop_over_for_loop: true
|
|
||||||
precedence_mistakes: true
|
|
||||||
precedence_in_conditions: true
|
|
||||||
phpunit_assertions: true
|
|
||||||
php5_style_constructor: true
|
|
||||||
parse_doc_comments: true
|
|
||||||
parameter_non_unique: true
|
|
||||||
parameter_doc_comments: true
|
|
||||||
param_doc_comment_if_not_inferrable: true
|
|
||||||
optional_parameters_at_the_end: true
|
|
||||||
one_class_per_file: true
|
|
||||||
no_unnecessary_if: true
|
|
||||||
no_trailing_whitespace: true
|
|
||||||
no_property_on_interface: true
|
|
||||||
no_non_implemented_abstract_methods: true
|
|
||||||
no_error_suppression: true
|
|
||||||
no_duplicate_arguments: true
|
|
||||||
no_commented_out_code: true
|
|
||||||
newline_at_end_of_file: true
|
|
||||||
missing_arguments: true
|
|
||||||
method_calls_on_non_object: true
|
|
||||||
instanceof_class_exists: true
|
|
||||||
foreach_traversable: true
|
|
||||||
fix_line_ending: true
|
|
||||||
fix_doc_comments: true
|
|
||||||
duplication: true
|
|
||||||
deprecated_code_usage: true
|
|
||||||
deadlock_detection_in_loops: true
|
|
||||||
code_rating: true
|
|
||||||
closure_use_not_conflicting: true
|
|
||||||
catch_class_exists: true
|
|
||||||
blank_line_after_namespace_declaration: false
|
|
||||||
avoid_multiple_statements_on_same_line: true
|
|
||||||
avoid_duplicate_types: true
|
|
||||||
avoid_conflicting_incrementers: true
|
|
||||||
avoid_closing_tag: true
|
|
||||||
assignment_of_null_return: true
|
|
||||||
argument_type_checks: true
|
|
||||||
|
|
||||||
filter:
|
|
||||||
paths: [code/*, tests/*]
|
|
29
CHANGELOG.md
29
CHANGELOG.md
@ -1,29 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
||||||
|
|
||||||
Older releases can be found on Github.
|
|
||||||
|
|
||||||
## 2.1.7
|
|
||||||
|
|
||||||
- Adds legacy file for migration from Silverstripe 3
|
|
||||||
|
|
||||||
Full changelog: https://github.com/wilr/silverstripe-googlesitemaps/compare/2.1.6...2.1.7
|
|
||||||
|
|
||||||
## 2.1.6
|
|
||||||
|
|
||||||
- Fixes incorrect priority calculations
|
|
||||||
|
|
||||||
Full changelog: https://github.com/wilr/silverstripe-googlesitemaps/compare/2.1.5...2.1.6
|
|
||||||
|
|
||||||
## 2.1.5
|
|
||||||
|
|
||||||
- FIX: enable stream context to pass through CWP egres proxy, fixes #156
|
|
||||||
|
|
||||||
Full changelog: https://github.com/wilr/silverstripe-googlesitemaps/compare/2.1.4...2.1.5
|
|
||||||
|
|
||||||
## 2.1.4
|
|
||||||
|
|
||||||
- Fixes extending alterSiteMap to support falsey values
|
|
||||||
|
|
||||||
Full changelog: https://github.com/wilr/silverstripe-googlesitemaps/compare/2.1.3...2.1.4
|
|
@ -6,12 +6,16 @@
|
|||||||
|
|
||||||
## Maintainer Contact
|
## Maintainer Contact
|
||||||
|
|
||||||
* Will Rossiter (Nickname: wrossiter, willr) <will@fullscreen.io>
|
- Will Rossiter (Nickname: wrossiter, willr) <will@fullscreen.io>
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
> composer require "wilr/silverstripe-googlesitemaps"
|
> composer require "wilr/silverstripe-googlesitemaps"
|
||||||
|
|
||||||
|
If you're using Silverstripe 5 then version `3` or `dev-main` will work.
|
||||||
|
|
||||||
|
For Silverstripe 4 use the `2.x` branch line.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
Provides support for the [Sitemaps XML Protocol](http://www.sitemaps.org/protocol.html),
|
Provides support for the [Sitemaps XML Protocol](http://www.sitemaps.org/protocol.html),
|
||||||
@ -30,4 +34,4 @@ See docs/en for more information about configuring the module.
|
|||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
* Flush this route to ensure the changes take effect (e.g http://yoursite.com/sitemap.xml?flush=1)
|
- Flush this route to ensure the changes take effect (e.g http://yoursite.com/sitemap.xml?flush=1)
|
||||||
|
10
_config.php
Normal file
10
_config.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\Core\ClassInfo;
|
||||||
|
use Wilr\GoogleSitemaps\GoogleSitemap;
|
||||||
|
|
||||||
|
if (0 === strpos(ltrim($_SERVER['REQUEST_URI'], '/'), 'sitemap')) {
|
||||||
|
foreach (ClassInfo::implementorsOf(Sitemapable::class) as $className) {
|
||||||
|
GoogleSitemap::register_dataobject($className);
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@ Name: googlesitemaps
|
|||||||
Wilr\GoogleSitemaps\GoogleSitemap:
|
Wilr\GoogleSitemaps\GoogleSitemap:
|
||||||
enabled: true
|
enabled: true
|
||||||
objects_per_sitemap: 1000
|
objects_per_sitemap: 1000
|
||||||
google_notification_enabled: false
|
|
||||||
use_show_in_search: true
|
use_show_in_search: true
|
||||||
---
|
---
|
||||||
Only:
|
Only:
|
||||||
|
267
css/style.css
267
css/style.css
@ -1,144 +1,145 @@
|
|||||||
*{
|
:root {
|
||||||
|
--color-black: #292B2E;
|
||||||
|
--color-blue-bright: #005AE1;
|
||||||
|
--color-blue-dark: #003E94;
|
||||||
|
--color-blue-light: #E6EDF4;
|
||||||
|
--color-grey-dark: #595D64;
|
||||||
|
--color-grey-light: #f7f8f8;
|
||||||
|
--color-grey-medium: #DCDEE0;
|
||||||
|
--color-white: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-size: 10px;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
body, table {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Helvetica, Arial, sans-serif;
|
background: var(--color-white);
|
||||||
font-size: 14px;
|
color: var(--color-grey-dark);
|
||||||
color: #545353;
|
|
||||||
color: #005A92;
|
|
||||||
background: #B0BEC7;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
}
|
||||||
#content {
|
|
||||||
margin: 0 auto;
|
table {
|
||||||
max-width: 1200px;
|
border-collapse: collapse;
|
||||||
background: #fff;
|
color: var(--color-black);
|
||||||
padding: 20px 30px;
|
text-align: left;
|
||||||
-webkit-box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.2);
|
width: 100%;
|
||||||
box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.2);
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
}
|
||||||
h1{
|
|
||||||
font-size: 20px;
|
a {
|
||||||
line-height: 24px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #1556B2;
|
|
||||||
color: #005A92;
|
|
||||||
/* text-shadow: 1px 1px 1px rgba(0,0,0,0.7);
|
|
||||||
filter: dropshadow(color=#000, offx=2, offy=2);*/
|
|
||||||
padding-left: 31px;
|
|
||||||
background: url("../images/logo_small.png") transparent left top no-repeat scroll;
|
|
||||||
margin: 0 0 20px 0;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
h1 a{
|
|
||||||
font: inherit;
|
|
||||||
color: inherit;
|
color: inherit;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
h1 .ss_link{
|
|
||||||
visibility: hidden;
|
.content {
|
||||||
font-size: 9px;
|
margin: 0 auto;
|
||||||
|
max-width: 122rem;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content__title {
|
||||||
|
align-items: center;
|
||||||
|
color: var(--color-black);
|
||||||
|
display: inline-flex;
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin: 0 0 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content__title::before {
|
||||||
|
content: "";
|
||||||
|
background: url("../images/cms_logo.svg") left center no-repeat;
|
||||||
|
border-right: 0.1rem solid var(--color-grey-medium);
|
||||||
|
display: inline-block;
|
||||||
|
height: 3.2rem;
|
||||||
|
margin-right: 1.5rem;
|
||||||
|
padding-right: 1.5rem;
|
||||||
|
width: 3.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content__text {
|
||||||
|
margin: 1rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content__text a {
|
||||||
|
color: var(--color-blue-bright);
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content__text a:hover {
|
||||||
|
color: var(--color-blue-dark);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-wrapper {
|
||||||
|
border-top: 0.1rem solid var(--color-grey-medium);
|
||||||
|
margin: 3rem 0 5rem;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table__cell {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table__cell--w-10 {
|
||||||
|
width: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table__cell--w-15 {
|
||||||
|
width: 15%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table__cell--w-65 {
|
||||||
|
width: 65%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table__cell--w-85 {
|
||||||
|
width: 85%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table tbody tr:nth-child(odd) td {
|
||||||
|
background-color: var(--color-grey-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table tbody tr:hover td {
|
||||||
|
background-color: var(--color-blue-light);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-table__cell {
|
||||||
|
padding: 1rem 1rem 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-table__cell--image {
|
||||||
|
width: 6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-table__cell--text {
|
||||||
|
width: calc(100% - 6rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-table__image {
|
||||||
|
height: 4rem;
|
||||||
|
object-fit: cover;
|
||||||
|
width: 6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-table__title {
|
||||||
display: block;
|
display: block;
|
||||||
text-align: right;
|
|
||||||
margin-top: -5px;
|
|
||||||
}
|
|
||||||
h1:hover .ss_link{
|
|
||||||
visibility: visible;
|
|
||||||
text-decoration: underline;
|
|
||||||
|
|
||||||
}
|
|
||||||
.expl {
|
|
||||||
margin: 10px 3px;
|
|
||||||
line-height: 1.3em;
|
|
||||||
}
|
|
||||||
.expl a {
|
|
||||||
color: #1556B2;
|
|
||||||
font-weight: bold;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
.expl a:hover{
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.tablesorter {
|
|
||||||
background-color: #CDCDCD;
|
|
||||||
margin:20px 0pt 15px;
|
|
||||||
font-size: 8pt;
|
|
||||||
width: 100%;
|
|
||||||
text-align: left;
|
|
||||||
border: none;
|
|
||||||
border-collapse: collapse;
|
|
||||||
border-bottom: 1px solid #005A92;
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
|
|
||||||
/*background-color: #e6EEEE;*/
|
|
||||||
background-color: #F5FAFA;
|
|
||||||
font-size: 8pt;
|
|
||||||
padding: 4px 20px 4px 10px;
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
|
|
||||||
background-color: #B0BEC7;
|
|
||||||
background-color: #e6EEEE;
|
|
||||||
}
|
|
||||||
|
|
||||||
table.tablesorter thead tr .header {
|
|
||||||
background-image: url("../images/bg.gif");
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-position: center right;
|
|
||||||
cursor: pointer;
|
|
||||||
border-bottom: 1px solid #005A92;
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr .headerSortUp {
|
|
||||||
background-image: url("../images/asc.gif");
|
|
||||||
}
|
|
||||||
table.tablesorter thead tr .headerSortDown {
|
|
||||||
background-image: url("../images/desc.gif");
|
|
||||||
}
|
|
||||||
|
|
||||||
table.tablesorter tbody td {
|
|
||||||
color: #005A92;
|
|
||||||
padding: 4px;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
table.tablesorter tbody tr{
|
|
||||||
background-color: #FFF;
|
|
||||||
}
|
|
||||||
table.tablesorter tbody tr.odd {
|
|
||||||
background-color:#EFF2F3;
|
|
||||||
}
|
|
||||||
table.tablesorter tbody tr:hover {
|
|
||||||
background-color: #D8E1E8;
|
|
||||||
}
|
|
||||||
table.tablesorter tbody a{
|
|
||||||
color: #444;color: #005A92;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
table.tablesorter tbody a:hover{
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
table.tablesorter tbody tr:hover td,
|
|
||||||
table.tablesorter tbody tr:hover a{
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
table.imagestable,
|
|
||||||
table.imagestable a {
|
|
||||||
font-size: 8pt;
|
|
||||||
}
|
|
||||||
table.imagestable {
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
table.imagestable tr.odd {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
table.imagestable tr.even {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#Footer{
|
|
||||||
margin: 50px 0 10px;
|
|
||||||
text-align: right;
|
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
# Google Sitemaps Module
|
# Google Sitemaps Module
|
||||||
|
|
||||||
SilverStripe provides support for the Google Sitemaps XML system, enabling
|
Silverstripe CMS provides support for the Google Sitemaps XML system, enabling
|
||||||
Google and other search engines to see all pages on your site. This helps
|
Google and other search engines to see all pages on your site. This helps
|
||||||
your SilverStripe website rank well in search engines, and to encourage the
|
your Silverstripe CMS website rank well in search engines, and to encourage the
|
||||||
information on your site to be discovered by Google quickly.
|
information on your site to be discovered by Google quickly.
|
||||||
|
|
||||||
Therefore, all Silverstripe websites contain a special controller which can be
|
Therefore, all Silverstripe CMS websites contain a special controller which can
|
||||||
visited: http://yoursite.com/sitemap.xml. This is not a file directly, but
|
be visited: http://yoursite.com/sitemap.xml. This is not a file directly, but
|
||||||
rather a custom route which points to the GoogleSitemap controller.
|
rather a custom route which points to the GoogleSitemap controller.
|
||||||
|
|
||||||
See http://en.wikipedia.org/wiki/Sitemaps for info on the Google Sitemap
|
See http://en.wikipedia.org/wiki/Sitemaps for info on the Google Sitemap
|
||||||
format.
|
format.
|
||||||
|
|
||||||
Whenever you publish a new or republish an existing page, SilverStripe can
|
Whenever you publish a new or republish an existing page, Silverstripe CMS can
|
||||||
automatically inform Google of the change, encouraging a Google to take notice.
|
automatically inform Google of the change, encouraging a Google to take notice.
|
||||||
If you install the SilverStripe Google Analytics module, you can see if Google
|
If you install the Silverstripe CMS Google Analytics module, you can see if Google
|
||||||
has updated your page as a result.
|
has updated your page as a result.
|
||||||
|
|
||||||
By default, SilverStripe informs Google that the importance of a page depends
|
By default, Silverstripe CMS informs Google that the importance of a page depends
|
||||||
on its position of in the sitemap. "Top level" pages are most important, and
|
on its position of in the sitemap. "Top level" pages are most important, and
|
||||||
the deeper a page is nested, the less important it is. (For each level,
|
the deeper a page is nested, the less important it is. (For each level,
|
||||||
Importance drops from 1.0, to 0.9, to 0.8, and so on, until 0.1 is reached).
|
Importance drops from 1.0, to 0.9, to 0.8, and so on, until 0.1 is reached).
|
||||||
@ -27,45 +27,32 @@ manually, including requesting to have the page excluded from the sitemap.
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Most module configuration is done via the SilverStripe Config API. Create a new
|
Most module configuration is done via the Silverstripe CMS Config API. Create a
|
||||||
config file `mysite/_config/googlesitemaps.yml` with the following outline:
|
new config file `mysite/_config/googlesitemaps.yml` with the following outline:
|
||||||
|
|
||||||
---
|
```yml
|
||||||
Name: customgooglesitemaps
|
---
|
||||||
After: googlesitemaps
|
Name: customgooglesitemaps
|
||||||
---
|
After: googlesitemaps
|
||||||
Wilr\GoogleSitemaps\GoogleSitemap:
|
---
|
||||||
|
Wilr\GoogleSitemaps\GoogleSitemap:
|
||||||
enabled: true
|
enabled: true
|
||||||
objects_per_sitemap: 1000
|
objects_per_sitemap: 1000
|
||||||
google_notification_enabled: false
|
|
||||||
use_show_in_search: true
|
use_show_in_search: true
|
||||||
|
```
|
||||||
|
|
||||||
You can now alter any of those properties to set your needs. A popular option
|
You can now alter any of those properties to set your needs.
|
||||||
is to turn on automatic pinging so that Google is notified of any updates to
|
|
||||||
your page. You can set this in the file we created in the last paragraph by
|
|
||||||
editing the `google_notification_enabled` option to true
|
|
||||||
|
|
||||||
---
|
```yml
|
||||||
Name: customgooglesitemaps
|
---
|
||||||
After: googlesitemaps
|
Name: customgooglesitemaps
|
||||||
---
|
After: googlesitemaps
|
||||||
Wilr\GoogleSitemaps\GoogleSitemap:
|
---
|
||||||
|
Wilr\GoogleSitemaps\GoogleSitemap:
|
||||||
enabled: true
|
enabled: true
|
||||||
objects_per_sitemap: 1000
|
objects_per_sitemap: 1000
|
||||||
google_notification_enabled: true
|
|
||||||
use_show_in_search: true
|
use_show_in_search: true
|
||||||
|
```
|
||||||
### Bing Ping Support
|
|
||||||
|
|
||||||
To ping Bing whenever your sitemap is updated, set `bing_notification_enabled`
|
|
||||||
|
|
||||||
---
|
|
||||||
Name: customgooglesitemaps
|
|
||||||
After: googlesitemaps
|
|
||||||
---
|
|
||||||
Wilr\GoogleSitemaps\GoogleSitemap:
|
|
||||||
enabled: true
|
|
||||||
bing_notification_enabled: true
|
|
||||||
|
|
||||||
### Including DataObjects
|
### Including DataObjects
|
||||||
|
|
||||||
@ -76,8 +63,8 @@ database as DataObject subclasses.
|
|||||||
To include a DataObject instance in the Sitemap it requires that your subclass
|
To include a DataObject instance in the Sitemap it requires that your subclass
|
||||||
defines two functions:
|
defines two functions:
|
||||||
|
|
||||||
* AbsoluteLink() function which returns the URL for this DataObject
|
- AbsoluteLink() function which returns the URL for this DataObject
|
||||||
* canView() function which returns a boolean value.
|
- canView() function which returns a boolean value.
|
||||||
|
|
||||||
The following is a barebones example of a DataObject called 'MyDataObject'. It
|
The following is a barebones example of a DataObject called 'MyDataObject'. It
|
||||||
assumes that you have a controller called 'MyController' which has a show method
|
assumes that you have a controller called 'MyController' which has a show method
|
||||||
@ -103,10 +90,9 @@ to show the DataObject by its ID.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
After those methods have been defined on your DataObject you now need to tell
|
After those methods have been defined on your DataObject you now need to tell
|
||||||
the Google Sitemaps module that it should be listed in the sitemap.xml file. To
|
the Google Sitemaps module that it should be listed in the sitemap.xml file. To
|
||||||
do that, include the following in your _config.php file.
|
do that, include the following in your \_config.php file.
|
||||||
|
|
||||||
use Wilr\GoogleSitemaps\GoogleSitemap;
|
use Wilr\GoogleSitemaps\GoogleSitemap;
|
||||||
|
|
||||||
@ -126,10 +112,10 @@ http://www.silvercart.org/blog/dataobjects-and-googlesitemaps/
|
|||||||
|
|
||||||
### Including custom routes
|
### Including custom routes
|
||||||
|
|
||||||
Occasionally you may have a need to include custom url's in your sitemap for
|
Occasionally you may have a need to include custom URLs in your sitemap for
|
||||||
your Controllers and other pages which don't exist in the database. To update
|
your Controllers and other pages which don't exist in the database. To update
|
||||||
the sitemap to include those links call register_routes() with your array of
|
the sitemap to include those links call register_routes() with your array of
|
||||||
urls to include.
|
URLs to include.
|
||||||
|
|
||||||
use Wilr\GoogleSitemaps\GoogleSitemap;
|
use Wilr\GoogleSitemaps\GoogleSitemap;
|
||||||
|
|
||||||
@ -138,3 +124,21 @@ urls to include.
|
|||||||
'/Security/',
|
'/Security/',
|
||||||
'/Security/login/'
|
'/Security/login/'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
### Sitemapable
|
||||||
|
|
||||||
|
For automatic registration of a DataObject subclass, implement the `Sitemapable`
|
||||||
|
extension.
|
||||||
|
|
||||||
|
```
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
class MyDataObject extends DataObject implements Sitemapable
|
||||||
|
{
|
||||||
|
public function AbsoluteLink()
|
||||||
|
{
|
||||||
|
// ..
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
BIN
images/asc.gif
BIN
images/asc.gif
Binary file not shown.
Before Width: | Height: | Size: 54 B |
BIN
images/bg.gif
BIN
images/bg.gif
Binary file not shown.
Before Width: | Height: | Size: 64 B |
4
images/cms_logo.svg
Normal file
4
images/cms_logo.svg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<svg width="32" height="19" viewBox="0 0 32 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M15.832 1.85439L9.09495 6.56978C8.16307 7.22084 7.93658 8.50206 8.58764 9.43478C9.2387 10.3667 10.5199 10.5931 11.4526 9.94209L18.1897 5.2267C20.9787 3.27352 24.8307 3.95216 26.7772 6.74111C28.7304 9.53005 28.0518 13.3821 25.2628 15.3286L23.145 16.8087C24.8993 19.7899 28.8675 18.5354 30.6702 15.3353C32.5549 11.9905 32.4863 7.72146 30.1428 4.37673C26.8926 -0.263432 20.4714 -1.39422 15.832 1.85439Z" fill="#005AE1"/>
|
||||||
|
<path d="M16.1671 16.6776L22.9042 11.9622C23.836 11.3112 24.0625 10.03 23.4115 9.09724C22.7604 8.16536 21.4792 7.93887 20.5465 8.58993L13.8094 13.3053C11.0204 15.2585 7.1684 14.5799 5.22191 11.7909C3.26873 9.00196 3.94737 5.14992 6.73631 3.20343L8.85414 1.72329C7.1007 -1.25705 3.1325 -0.00256691 1.32975 3.19758C-0.554895 6.54231 -0.486362 10.8114 1.85712 14.1561C5.10574 18.7955 11.5269 19.9338 16.1671 16.6785V16.6776Z" fill="#005AE1"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 970 B |
BIN
images/desc.gif
BIN
images/desc.gif
Binary file not shown.
Before Width: | Height: | Size: 54 B |
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ruleset name="SilverStripe">
|
<ruleset name="SilverStripe">
|
||||||
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
|
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
|
||||||
|
<file>src</file>
|
||||||
|
<file>tests</file>
|
||||||
<!-- base rules are PSR-2 -->
|
<!-- base rules are PSR-2 -->
|
||||||
<rule ref="PSR2" >
|
<rule ref="PSR2">
|
||||||
<!-- Current exclusions -->
|
<!-- Current exclusions -->
|
||||||
<exclude name="PSR1.Methods.CamelCapsMethodName" />
|
<exclude name="PSR1.Methods.CamelCapsMethodName" />
|
||||||
</rule>
|
</rule>
|
||||||
|
@ -4,9 +4,8 @@ namespace Wilr\GoogleSitemaps\Control;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Core\Manifest\ModuleResourceLoader;
|
|
||||||
use Wilr\GoogleSitemaps\GoogleSitemap;
|
use Wilr\GoogleSitemaps\GoogleSitemap;
|
||||||
use SilverStripe\View\ArrayData;
|
use SilverStripe\View\ArrayData;
|
||||||
|
|
||||||
@ -52,7 +51,7 @@ class GoogleSitemapController extends Controller
|
|||||||
$this->extend('updateGoogleSitemaps', $sitemaps);
|
$this->extend('updateGoogleSitemaps', $sitemaps);
|
||||||
|
|
||||||
return $this->customise(new ArrayData([
|
return $this->customise(new ArrayData([
|
||||||
'Sitemaps' => $sitemaps
|
'Sitemaps' => $sitemaps,
|
||||||
]))->renderWith(__CLASS__);
|
]))->renderWith(__CLASS__);
|
||||||
} else {
|
} else {
|
||||||
return new HTTPResponse('Page not found', 404);
|
return new HTTPResponse('Page not found', 404);
|
||||||
@ -70,6 +69,12 @@ class GoogleSitemapController extends Controller
|
|||||||
$class = $this->unsanitiseClassName($this->request->param('ID'));
|
$class = $this->unsanitiseClassName($this->request->param('ID'));
|
||||||
$page = intval($this->request->param('OtherID'));
|
$page = intval($this->request->param('OtherID'));
|
||||||
|
|
||||||
|
if ($page) {
|
||||||
|
if (!is_numeric($page)) {
|
||||||
|
return new HTTPResponse('Page not found', 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GoogleSitemap::enabled()
|
if (GoogleSitemap::enabled()
|
||||||
&& $class
|
&& $class
|
||||||
&& ($page > 0)
|
&& ($page > 0)
|
||||||
@ -123,4 +128,10 @@ class GoogleSitemapController extends Controller
|
|||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function AbsoluteLink($action = null)
|
||||||
|
{
|
||||||
|
return rtrim(Controller::join_links(Director::absoluteBaseURL(), 'sitemap.xml', $action), '/');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class GoogleSitemapExtension extends DataExtension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$objHttp = parse_url($this->owner->AbsoluteLink(), PHP_URL_HOST);
|
$objHttp = parse_url($this->owner->AbsoluteLink() ?? '', PHP_URL_HOST);
|
||||||
|
|
||||||
if ($objHttp != $hostHttp) {
|
if ($objHttp != $hostHttp) {
|
||||||
$can = false;
|
$can = false;
|
||||||
@ -66,27 +66,13 @@ class GoogleSitemapExtension extends DataExtension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_array($can) && isset($can[0])) {
|
||||||
|
return $can[0];
|
||||||
|
}
|
||||||
|
|
||||||
return $can;
|
return $can;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function onAfterPublish()
|
|
||||||
{
|
|
||||||
GoogleSitemap::ping();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function onAfterUnpublish()
|
|
||||||
{
|
|
||||||
GoogleSitemap::ping();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default value of the priority field depends on the depth of the page in
|
* The default value of the priority field depends on the depth of the page in
|
||||||
* the site tree, so it must be calculated dynamically.
|
* the site tree, so it must be calculated dynamically.
|
||||||
|
@ -104,6 +104,10 @@ class GoogleSitemapSiteTreeExtension extends GoogleSitemapExtension
|
|||||||
$result = parent::canIncludeInGoogleSitemap();
|
$result = parent::canIncludeInGoogleSitemap();
|
||||||
$result = ($this->owner instanceof ErrorPage) ? false : $result;
|
$result = ($this->owner instanceof ErrorPage) ? false : $result;
|
||||||
|
|
||||||
|
if (is_array($result) && isset($result[0])) {
|
||||||
|
return $result[0];
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,17 +29,8 @@ use ReflectionException;
|
|||||||
* The GoogleSitemap handle requests to 'sitemap.xml' the other two classes are
|
* The GoogleSitemap handle requests to 'sitemap.xml' the other two classes are
|
||||||
* used to render the sitemap.
|
* used to render the sitemap.
|
||||||
*
|
*
|
||||||
* You can notify ("ping") Google about a changed sitemap automatically whenever
|
* The config file is usually located in the _config folder of your project folder.
|
||||||
* a new page is published or unpublished.
|
* e.g. app/_config/googlesitemaps.yml
|
||||||
*
|
|
||||||
* By default, Google is not notified, and will pick up your new sitemap
|
|
||||||
* whenever the GoogleBot visits your website.
|
|
||||||
*
|
|
||||||
* To Enable notification of Google after every publish set google_notification_enabled
|
|
||||||
* to true in the googlesitemaps.yml config file.
|
|
||||||
*
|
|
||||||
* This file is usually located in the _config folder of your project folder.
|
|
||||||
* e.g mysite/_config/googlesitemaps.yml
|
|
||||||
*
|
*
|
||||||
* <example>
|
* <example>
|
||||||
* ---
|
* ---
|
||||||
@ -49,7 +40,6 @@ use ReflectionException;
|
|||||||
* Wilr\GoogleSitemaps\GoogleSitemap:
|
* Wilr\GoogleSitemaps\GoogleSitemap:
|
||||||
* enabled: true
|
* enabled: true
|
||||||
* objects_per_sitemap: 1000
|
* objects_per_sitemap: 1000
|
||||||
* google_notification_enabled: true
|
|
||||||
* use_show_in_search: true
|
* use_show_in_search: true
|
||||||
* </example>
|
* </example>
|
||||||
*
|
*
|
||||||
@ -84,16 +74,6 @@ class GoogleSitemap
|
|||||||
*/
|
*/
|
||||||
private static $exclude_redirector_pages = true;
|
private static $exclude_redirector_pages = true;
|
||||||
|
|
||||||
/**
|
|
||||||
* @config
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private static $search_indexes = [
|
|
||||||
'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=',
|
|
||||||
'bing' => 'http://www.bing.com/ping?sitemap=',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorates the given DataObject with {@link GoogleSitemapDecorator}
|
* Decorates the given DataObject with {@link GoogleSitemapDecorator}
|
||||||
* and pushes the class name to the registered DataObjects.
|
* and pushes the class name to the registered DataObjects.
|
||||||
@ -236,7 +216,8 @@ class GoogleSitemap
|
|||||||
*/
|
*/
|
||||||
public function getItems($class, $page = 1)
|
public function getItems($class, $page = 1)
|
||||||
{
|
{
|
||||||
//normalise the class name
|
$page = (int) $page;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$reflectionClass = new ReflectionClass($class);
|
$reflectionClass = new ReflectionClass($class);
|
||||||
$class = $reflectionClass->getName();
|
$class = $reflectionClass->getName();
|
||||||
@ -246,7 +227,7 @@ class GoogleSitemap
|
|||||||
}
|
}
|
||||||
|
|
||||||
$output = new ArrayList();
|
$output = new ArrayList();
|
||||||
$count = Config::inst()->get(__CLASS__, 'objects_per_sitemap');
|
$count = (int) Config::inst()->get(__CLASS__, 'objects_per_sitemap');
|
||||||
$filter = Config::inst()->get(__CLASS__, 'use_show_in_search');
|
$filter = Config::inst()->get(__CLASS__, 'use_show_in_search');
|
||||||
$redirector = Config::inst()->get(__CLASS__, 'exclude_redirector_pages');
|
$redirector = Config::inst()->get(__CLASS__, 'exclude_redirector_pages');
|
||||||
|
|
||||||
@ -416,7 +397,7 @@ class GoogleSitemap
|
|||||||
->limit($countPerFile, ($i - 1) * $countPerFile)
|
->limit($countPerFile, ($i - 1) * $countPerFile)
|
||||||
->last();
|
->last();
|
||||||
|
|
||||||
$lastModified = ($sliced) ? date('Y-m-d', strtotime($sliced->LastEdited)): date('Y-m-d');
|
$lastModified = ($sliced) ? date('Y-m-d', strtotime($sliced->LastEdited)) : date('Y-m-d');
|
||||||
|
|
||||||
$sitemaps->push(new ArrayData(array(
|
$sitemaps->push(new ArrayData(array(
|
||||||
'ClassName' => $this->sanitiseClassName($class),
|
'ClassName' => $this->sanitiseClassName($class),
|
||||||
@ -452,41 +433,6 @@ class GoogleSitemap
|
|||||||
return static::inst()->getSitemaps();
|
return static::inst()->getSitemaps();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies search indexes about changes to your sitemap. This behavior is disabled
|
|
||||||
* by default, to enable, read the documentation provided in the docs folder.
|
|
||||||
*
|
|
||||||
* After notifications have been enabled, every publish / unpublish of a page.
|
|
||||||
* will notify enabled search indexes of the update.
|
|
||||||
*
|
|
||||||
* If the site is in development mode no ping will be sent.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public static function ping()
|
|
||||||
{
|
|
||||||
if (!self::enabled() || Director::isDev()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$location = urlencode(Controller::join_links(
|
|
||||||
Director::absoluteBaseURL(),
|
|
||||||
'sitemap.xml'
|
|
||||||
));
|
|
||||||
|
|
||||||
$response = true;
|
|
||||||
|
|
||||||
foreach (self::config()->search_indexes as $name => $url) {
|
|
||||||
$configName = $name . '_notification_enabled';
|
|
||||||
|
|
||||||
if (self::config()->$configName) {
|
|
||||||
$response = $response && file_get_contents($url . $location);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is GoogleSitemap enabled?
|
* Is GoogleSitemap enabled?
|
||||||
*
|
*
|
||||||
|
14
src/Sitemapable.php
Normal file
14
src/Sitemapable.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace Wilr\GoogleSitemaps;
|
||||||
|
|
||||||
|
interface Sitemapable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Return the absolute URL for this object
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function AbsoluteLink();
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?xml-stylesheet type='text/xsl' href='{$AbsoluteBaseURL}/sitemap.xml/styleSheetIndex'?>
|
<?xml-stylesheet type='text/xsl' href='{$AbsoluteLink('styleSheetIndex')}'?>
|
||||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><% loop Sitemaps %>
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><% loop Sitemaps %>
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>{$AbsoluteBaseURL}/sitemap.xml/sitemap/$ClassName/$Page.xml</loc>
|
<loc>{$Up.AbsoluteLink('sitemap')}/{$ClassName}/{$Page.xml}</loc>
|
||||||
<% if $LastModified %><lastmod>$LastModified</lastmod><% end_if %>
|
<% if $LastModified %><lastmod>{$LastModified}</lastmod><% end_if %>
|
||||||
</sitemap><% end_loop %>
|
</sitemap><% end_loop %>
|
||||||
</sitemapindex>
|
</sitemapindex>
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?xml-stylesheet type='text/xsl' href='{$AbsoluteBaseURL}/sitemap.xml/styleSheet'?>
|
<?xml-stylesheet type='text/xsl' href='{$AbsoluteLink('styleSheet')}'?>
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
|
||||||
<% loop $Items %>
|
<% loop $Items %>
|
||||||
<url>
|
<url>
|
||||||
<loc>$AbsoluteLink</loc>
|
<loc>{$AbsoluteLink}</loc>
|
||||||
<% if $LastEdited %><lastmod>$LastEdited.Rfc3339()</lastmod><% end_if %>
|
<% if $LastEdited %><lastmod>{$LastEdited.Rfc3339()}</lastmod><% end_if %>
|
||||||
<% if $ChangeFrequency %><changefreq>$ChangeFrequency</changefreq><% end_if %>
|
<% if $ChangeFrequency %><changefreq>$ChangeFrequency</changefreq><% end_if %>
|
||||||
<% if $GooglePriority %><priority>$GooglePriority</priority><% end_if %>
|
<% if $GooglePriority %><priority>$GooglePriority</priority><% end_if %>
|
||||||
<% if $ImagesForSitemap %><% loop $ImagesForSitemap %>
|
<% if $ImagesForSitemap %><% loop $ImagesForSitemap %>
|
||||||
|
@ -9,23 +9,21 @@
|
|||||||
<link rel="stylesheet" href="$resourceURL(wilr/silverstripe-googlesitemaps:css/style.css)" />
|
<link rel="stylesheet" href="$resourceURL(wilr/silverstripe-googlesitemaps:css/style.css)" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content">
|
<div class="content">
|
||||||
<h1>
|
<h1 class="content__title">
|
||||||
<a href="http://silverstripe.org" target="_blank">XML Sitemap
|
<a href="https://www.silverstripe.org" target="_blank" rel="noopener noreferrer">XML Sitemap</a>
|
||||||
<span class="ss_link">→ silverstripe.org</span>
|
|
||||||
</a>
|
|
||||||
</h1>
|
</h1>
|
||||||
|
<p class="content__text">
|
||||||
<p class="expl">
|
|
||||||
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
|
This sitemap contains <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/> URLs.
|
||||||
</p>
|
</p>
|
||||||
<table id="sitemap" cellpadding="3" class="tablesorter">
|
<div class="table-wrapper">
|
||||||
|
<table id="sitemap" class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="76%">URL</th>
|
<th class="table__cell table__cell--w-65">URL</th>
|
||||||
<th width="7%">Priority</th>
|
<th class="table__cell table__cell--w-10">Priority</th>
|
||||||
<th width="7%">Change Freq.</th>
|
<th class="table__cell table__cell--w-10">Change Freq.</th>
|
||||||
<th width="10%">Last Change</th>
|
<th class="table__cell table__cell--w-15">Last Change</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -33,7 +31,7 @@
|
|||||||
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
||||||
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td class="table__cell">
|
||||||
<xsl:variable name="itemURL">
|
<xsl:variable name="itemURL">
|
||||||
<xsl:value-of select="sitemap:loc"/>
|
<xsl:value-of select="sitemap:loc"/>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
@ -41,23 +39,21 @@
|
|||||||
<a href="{\$itemURL}">
|
<a href="{\$itemURL}">
|
||||||
<xsl:value-of select="sitemap:loc"/>
|
<xsl:value-of select="sitemap:loc"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
<xsl:if test="\$imagesCount > 0">
|
<xsl:if test="\$imagesCount > 0">
|
||||||
<table class="imagestable" cellpadding="0" cellspacing="0">
|
<table class="image-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Images</th>
|
<th class="image-table__cell">Images</th>
|
||||||
</tr>
|
</tr>
|
||||||
<xsl:for-each select="image:image">
|
<xsl:for-each select="image:image">
|
||||||
<xsl:variable name="imageURL">
|
<xsl:variable name="imageURL">
|
||||||
<xsl:value-of select="image:loc"/>
|
<xsl:value-of select="image:loc"/>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td class="image-table__cell image-table__cell--image">
|
||||||
<img src="{\$imageURL}" width="40px"/>
|
<img class="image-table__image" src="{\$imageURL}" width="60" height="40" />
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="image-table__cell image-table__cell--text">
|
||||||
<xsl:value-of select="image:title"/><br/>
|
<span class="image-table__title"><xsl:value-of select="image:title"/></span>
|
||||||
<a href="{\$imageURL}">
|
<a href="{\$imageURL}">
|
||||||
<xsl:value-of select="image:loc"/>
|
<xsl:value-of select="image:loc"/>
|
||||||
</a>
|
</a>
|
||||||
@ -66,25 +62,27 @@
|
|||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</table>
|
</table>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="table__cell">
|
||||||
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="table__cell">
|
||||||
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat(\$lower, \$upper),concat(\$upper, \$lower)),substring(sitemap:changefreq, 2))"/>
|
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat(\$lower, \$upper),concat(\$upper, \$lower)),substring(sitemap:changefreq, 2))"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="table__cell">
|
||||||
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p id="Footer" class="expl">Generated by the SilverStripe
|
</div>
|
||||||
<a href="https://github.com/wilr/silverstripe-googlesitemaps" target="_blank" title="SilverStripe Google Sitemaps module on Github">Google Sitemaps Module</a>
|
<p class="content__text">
|
||||||
<br />More information about XML sitemaps on <a href="http://sitemaps.org" target="_blank">sitemaps.org</a>.
|
Generated by the Silverstripe CMS
|
||||||
|
<a href="https://github.com/wilr/silverstripe-googlesitemaps" target="_blank" rel="noopener noreferrer" title="Silverstripe CMS Google Sitemaps module on Github">Google Sitemaps Module</a>
|
||||||
|
</p>
|
||||||
|
<p class="content__text">
|
||||||
|
More information about XML sitemaps on <a href="https://sitemaps.org" target="_blank" rel="noopener noreferrer">sitemaps.org</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -9,21 +9,19 @@
|
|||||||
<link rel="stylesheet" href="$resourceURL(wilr/silverstripe-googlesitemaps:css/style.css)" />
|
<link rel="stylesheet" href="$resourceURL(wilr/silverstripe-googlesitemaps:css/style.css)" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="content">
|
<div class="content">
|
||||||
<h1>
|
<h1 class="content__title">
|
||||||
<a href="http://silverstripe.org" target="_blank">XML Sitemap
|
<a href="https://www.silverstripe.org" target="_blank" rel="noopener noreferrer">XML Sitemap</a>
|
||||||
<span class="ss_link">→ silverstripe.org</span>
|
|
||||||
</a>
|
|
||||||
</h1>
|
</h1>
|
||||||
|
<p class="content__text">
|
||||||
<p class="expl">
|
|
||||||
This sitemap consists of <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> part(s).
|
This sitemap consists of <xsl:value-of select="count(sitemap:sitemapindex/sitemap:sitemap)"/> part(s).
|
||||||
</p>
|
</p>
|
||||||
<table id="sitemapindex" cellpadding="3" class="tablesorter">
|
<div class="table-wrapper">
|
||||||
|
<table id="sitemapindex" class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="90%">URL</th>
|
<th class="table__cell table__cell--w-85">URL</th>
|
||||||
<th width="10%">Last Change</th>
|
<th class="table__cell table__cell--w-15">Last Change</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -31,7 +29,7 @@
|
|||||||
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
||||||
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
<xsl:for-each select="sitemap:sitemapindex/sitemap:sitemap">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td class="table__cell">
|
||||||
<xsl:variable name="itemURL">
|
<xsl:variable name="itemURL">
|
||||||
<xsl:value-of select="sitemap:loc"/>
|
<xsl:value-of select="sitemap:loc"/>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
@ -39,16 +37,20 @@
|
|||||||
<xsl:value-of select="sitemap:loc"/>
|
<xsl:value-of select="sitemap:loc"/>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td class="table__cell">
|
||||||
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p id="Footer" class="expl">Generated by the SilverStripe
|
</div>
|
||||||
<a href="https://github.com/wilr/silverstripe-googlesitemaps" target="_blank" title="SilverStripe Google Sitemaps module on Github">Google Sitemaps Module</a>
|
<p class="content__text">
|
||||||
<br />More information about XML sitemaps on <a href="http://sitemaps.org" target="_blank">sitemaps.org</a>.
|
Generated by the Silverstripe CMS
|
||||||
|
<a href="https://github.com/wilr/silverstripe-googlesitemaps" target="_blank" rel="noopener noreferrer" title="SilverStripe Google Sitemaps module on Github">Google Sitemaps Module</a>
|
||||||
|
</p>
|
||||||
|
<p class="content__text">
|
||||||
|
More information about XML sitemaps on <a href="https://sitemaps.org" target="_blank" rel="noopener noreferrer">sitemaps.org</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -4,7 +4,6 @@ namespace Wilr\GoogleSitemaps\Tests;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Director;
|
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
@ -21,10 +20,22 @@ use Wilr\GoogleSitemaps\Tests\Model\UnviewableDataObject;
|
|||||||
class GoogleSitemapTest extends FunctionalTest
|
class GoogleSitemapTest extends FunctionalTest
|
||||||
{
|
{
|
||||||
protected static $fixture_file = [
|
protected static $fixture_file = [
|
||||||
'GoogleSitemapTest.yml',
|
'GoogleSitemapTest.yml'
|
||||||
'GoogleSitemapPageTest.yml',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $usesDatabase = true;
|
||||||
|
|
||||||
|
public static function get_fixture_file()
|
||||||
|
{
|
||||||
|
$files = [__DIR__ . '/GoogleSitemapTest.yml'];
|
||||||
|
|
||||||
|
if (class_exists('Page')) {
|
||||||
|
$files[] = __DIR__ . '/GoogleSitemapPageTest.yml';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
|
|
||||||
protected static $extra_dataobjects = [
|
protected static $extra_dataobjects = [
|
||||||
TestDataObject::class,
|
TestDataObject::class,
|
||||||
OtherDataObject::class,
|
OtherDataObject::class,
|
||||||
@ -54,13 +65,13 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
public function testCanIncludeInGoogleSitemap(): void
|
public function testCanIncludeInGoogleSitemap(): void
|
||||||
{
|
{
|
||||||
GoogleSitemap::register_dataobject(TestDataObject::class, '');
|
GoogleSitemap::register_dataobject(TestDataObject::class, '');
|
||||||
|
|
||||||
$unused = $this->objFromFixture(TestDataObject::class, 'UnindexedDataObject');
|
|
||||||
$this->assertFalse($unused->canIncludeInGoogleSitemap());
|
|
||||||
|
|
||||||
$used = $this->objFromFixture(TestDataObject::class, 'DataObjectTest2');
|
$used = $this->objFromFixture(TestDataObject::class, 'DataObjectTest2');
|
||||||
|
|
||||||
$this->assertTrue($used->canIncludeInGoogleSitemap());
|
$this->assertTrue($used->canIncludeInGoogleSitemap());
|
||||||
|
|
||||||
|
$used->setPrivate();
|
||||||
|
|
||||||
|
$this->assertFalse($used->canIncludeInGoogleSitemap());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndexFileWithCustomRoute(): void
|
public function testIndexFileWithCustomRoute(): void
|
||||||
@ -70,37 +81,39 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
$response = $this->get('sitemap.xml');
|
$response = $this->get('sitemap.xml');
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
|
|
||||||
$this->assertXmlStringEqualsXmlFile(__DIR__ . '/xml/' . __FUNCTION__ . '.xml', $body, 'A link to the custom routes exists');
|
$this->assertXmlStringEqualsXmlFile(
|
||||||
|
__DIR__ . '/xml/' . __FUNCTION__ . '.xml',
|
||||||
|
$body,
|
||||||
|
'A link to the custom routes exists'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetItems(): void
|
public function testGetItems(): void
|
||||||
{
|
{
|
||||||
GoogleSitemap::register_dataobject(TestDataObject::class, '');
|
GoogleSitemap::register_dataobject(TestDataObject::class, '');
|
||||||
|
$google = new GoogleSitemap();
|
||||||
|
|
||||||
$items = GoogleSitemap::get_items(TestDataObject::class, 1);
|
$items = $google->getItems(TestDataObject::class, 1);
|
||||||
$this->assertEquals(2, $items->count());
|
|
||||||
|
|
||||||
$this->assertListEquals(array(
|
$this->assertEquals(3, $items->count());
|
||||||
array("Priority" => "0.2"),
|
|
||||||
array("Priority" => "0.4")
|
|
||||||
), $items);
|
|
||||||
|
|
||||||
GoogleSitemap::register_dataobject(OtherDataObject::class);
|
GoogleSitemap::register_dataobject(OtherDataObject::class);
|
||||||
$this->assertEquals(1, GoogleSitemap::get_items(OtherDataObject::class, 1)->count());
|
$this->assertEquals(1, $google->getItems(OtherDataObject::class, 1)->count());
|
||||||
|
|
||||||
GoogleSitemap::register_dataobject(UnviewableDataObject::class);
|
GoogleSitemap::register_dataobject(UnviewableDataObject::class);
|
||||||
$this->assertEquals(0, GoogleSitemap::get_items(UnviewableDataObject::class, 1)->count());
|
$this->assertEquals(0, $google->getItems(UnviewableDataObject::class, 1)->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetItemsWithCustomRoutes(): void
|
public function testGetItemsWithCustomRoutes(): void
|
||||||
{
|
{
|
||||||
GoogleSitemap::register_routes(array(
|
GoogleSitemap::register_routes([
|
||||||
'/test-route/',
|
'/test-route/',
|
||||||
'/someother-route/',
|
'/someother-route/',
|
||||||
'/fake-sitemap-route/'
|
'/fake-sitemap-route/'
|
||||||
));
|
]);
|
||||||
|
|
||||||
$items = GoogleSitemap::get_items('GoogleSitemapRoute', 1);
|
$google = new GoogleSitemap();
|
||||||
|
$items = $google->getItems('GoogleSitemapRoute', 1);
|
||||||
$this->assertEquals(3, $items->count());
|
$this->assertEquals(3, $items->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +122,16 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
GoogleSitemap::register_dataobject(TestDataObject::class);
|
GoogleSitemap::register_dataobject(TestDataObject::class);
|
||||||
GoogleSitemap::register_dataobject(OtherDataObject::class);
|
GoogleSitemap::register_dataobject(OtherDataObject::class);
|
||||||
|
|
||||||
|
$obj = $this->objFromFixture(TestDataObject::class, 'DataObjectTest1');
|
||||||
|
$table = $obj->baseTable();
|
||||||
|
|
||||||
|
DB::query("UPDATE \"" . $table . "\" SET \"LastEdited\"='2023-02-13 00:00:00'");
|
||||||
|
|
||||||
|
$obj2 = $this->objFromFixture(OtherDataObject::class, 'OtherDataObjectTest2');
|
||||||
|
$table = $obj2->baseTable();
|
||||||
|
|
||||||
|
DB::query("UPDATE \"" . $table . "\" SET \"LastEdited\"='2023-02-13 00:00:00'");
|
||||||
|
|
||||||
$response = $this->get('sitemap.xml');
|
$response = $this->get('sitemap.xml');
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
|
|
||||||
@ -127,12 +150,12 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
$page->publishSingle();
|
$page->publishSingle();
|
||||||
$page->flushCache();
|
$page->flushCache();
|
||||||
|
|
||||||
$page2 = $this->objFromFixture('Page', 'Page2');
|
$p2 = $this->objFromFixture('Page', 'Page2');
|
||||||
$page2->publishSingle();
|
$p2->publishSingle();
|
||||||
$page2->flushCache();
|
$p2->flushCache();
|
||||||
|
|
||||||
DB::query("UPDATE \"SiteTree_Live\" SET \"LastEdited\"='2014-03-14 00:00:00' WHERE \"ID\"='".$page->ID."'");
|
DB::query("UPDATE \"SiteTree_Live\" SET \"LastEdited\"='2014-03-14 00:00:00' WHERE \"ID\"='" . $page->ID . "'");
|
||||||
DB::query("UPDATE \"SiteTree_Live\" SET \"LastEdited\"='2014-01-01 00:00:00' WHERE \"ID\"='".$page2->ID."'");
|
DB::query("UPDATE \"SiteTree_Live\" SET \"LastEdited\"='2014-01-01 00:00:00' WHERE \"ID\"='" . $p2->ID . "'");
|
||||||
|
|
||||||
$response = $this->get('sitemap.xml');
|
$response = $this->get('sitemap.xml');
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
@ -152,9 +175,19 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
Config::inst()->set(GoogleSitemap::class, 'objects_per_sitemap', 1);
|
Config::inst()->set(GoogleSitemap::class, 'objects_per_sitemap', 1);
|
||||||
GoogleSitemap::register_dataobject(TestDataObject::class);
|
GoogleSitemap::register_dataobject(TestDataObject::class);
|
||||||
|
|
||||||
|
|
||||||
|
$obj = $this->objFromFixture(TestDataObject::class, 'DataObjectTest1');
|
||||||
|
$obj1 = $this->objFromFixture(TestDataObject::class, 'DataObjectTest2');
|
||||||
|
$obj2 = $this->objFromFixture(TestDataObject::class, 'UnindexedDataObject');
|
||||||
|
|
||||||
|
$t = $obj->baseTable();
|
||||||
|
DB::query("UPDATE \"" . $t . "\" SET \"LastEdited\"='2023-02-13 00:00:00' WHERE \"ID\"='" . $obj->ID . "'");
|
||||||
|
DB::query("UPDATE \"" . $t . "\" SET \"LastEdited\"='2023-02-13 00:00:00' WHERE \"ID\"='" . $obj1->ID . "'");
|
||||||
|
DB::query("UPDATE \"" . $t . "\" SET \"LastEdited\"='2023-02-13 00:00:00' WHERE \"ID\"='" . $obj2->ID . "'");
|
||||||
|
|
||||||
|
|
||||||
$response = $this->get('sitemap.xml');
|
$response = $this->get('sitemap.xml');
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
|
|
||||||
$this->assertXmlStringEqualsXmlFile(__DIR__ . '/xml/' . __FUNCTION__ . '.xml', $body);
|
$this->assertXmlStringEqualsXmlFile(__DIR__ . '/xml/' . __FUNCTION__ . '.xml', $body);
|
||||||
|
|
||||||
Config::inst()->set(GoogleSitemap::class, 'objects_per_sitemap', $original);
|
Config::inst()->set(GoogleSitemap::class, 'objects_per_sitemap', $original);
|
||||||
@ -163,11 +196,11 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
public function testRegisterRoutesIncludesAllRoutes(): void
|
public function testRegisterRoutesIncludesAllRoutes(): void
|
||||||
{
|
{
|
||||||
GoogleSitemap::register_route('/test/');
|
GoogleSitemap::register_route('/test/');
|
||||||
GoogleSitemap::register_routes(array(
|
GoogleSitemap::register_routes([
|
||||||
'/test/', // duplication should be replaced
|
'/test/', // duplication should be replaced
|
||||||
'/unittests/',
|
'/unittests/',
|
||||||
'/anotherlink/'
|
'/anotherlink/'
|
||||||
), 'weekly');
|
], 'weekly');
|
||||||
|
|
||||||
$response = $this->get('sitemap.xml/sitemap/GoogleSitemapRoute/1');
|
$response = $this->get('sitemap.xml/sitemap/GoogleSitemapRoute/1');
|
||||||
$body = $response->getBody();
|
$body = $response->getBody();
|
||||||
@ -192,7 +225,7 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
|
|
||||||
public function testGetItemsWithPages(): void
|
public function testGetItemsWithPages(): void
|
||||||
{
|
{
|
||||||
if (!class_exists('Page')) {
|
if (!class_exists(SiteTree::class)) {
|
||||||
$this->markTestIncomplete('No cms module installed, page related test skipped');
|
$this->markTestIncomplete('No cms module installed, page related test skipped');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,10 +237,10 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
$page2->publishSingle();
|
$page2->publishSingle();
|
||||||
$page2->flushCache();
|
$page2->flushCache();
|
||||||
|
|
||||||
$this->assertListContains(array(
|
$this->assertListContains([
|
||||||
array('Title' => 'Testpage1'),
|
['Title' => 'Testpage1'],
|
||||||
array('Title' => 'Testpage2')
|
['Title' => 'Testpage2']
|
||||||
), GoogleSitemap::inst()->getItems(SiteTree::class), "There should be 2 pages in the sitemap after publishing");
|
], GoogleSitemap::inst()->getItems(SiteTree::class), "There should be 2 pages in the sitemap after publishing");
|
||||||
|
|
||||||
// check if we make a page readonly that it is hidden
|
// check if we make a page readonly that it is hidden
|
||||||
$page2->CanViewType = 'LoggedInUsers';
|
$page2->CanViewType = 'LoggedInUsers';
|
||||||
@ -216,9 +249,9 @@ class GoogleSitemapTest extends FunctionalTest
|
|||||||
|
|
||||||
$this->logOut();
|
$this->logOut();
|
||||||
|
|
||||||
$this->assertListEquals(array(
|
$this->assertListEquals([
|
||||||
array('Title' => 'Testpage1')
|
['Title' => 'Testpage1']
|
||||||
), GoogleSitemap::inst()->getItems(SiteTree::class), "There should be only 1 page, other is logged in only");
|
], GoogleSitemap::inst()->getItems(SiteTree::class), "There should be only 1 page, other is logged in only");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAccess(): void
|
public function testAccess(): void
|
||||||
|
@ -8,6 +8,7 @@ use SilverStripe\Control\Director;
|
|||||||
|
|
||||||
class TestDataObject extends DataObject implements TestOnly
|
class TestDataObject extends DataObject implements TestOnly
|
||||||
{
|
{
|
||||||
|
protected $private = false;
|
||||||
|
|
||||||
private static $db = array(
|
private static $db = array(
|
||||||
'Priority' => 'Varchar(10)'
|
'Priority' => 'Varchar(10)'
|
||||||
@ -15,9 +16,19 @@ class TestDataObject extends DataObject implements TestOnly
|
|||||||
|
|
||||||
public function canView($member = null)
|
public function canView($member = null)
|
||||||
{
|
{
|
||||||
|
if ($this->private) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function setPrivate()
|
||||||
|
{
|
||||||
|
$this->private = true;
|
||||||
|
}
|
||||||
|
|
||||||
public function AbsoluteLink()
|
public function AbsoluteLink()
|
||||||
{
|
{
|
||||||
return Director::absoluteBaseURL();
|
return Director::absoluteBaseURL();
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?xml-stylesheet type='text/xsl' href='http://localhostsitemap.xml/styleSheetIndex'?>
|
<?xml-stylesheet type='text/xsl' href='http://localhost/sitemap.xml/styleSheetIndex'?>
|
||||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1</loc>
|
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1</loc>
|
||||||
<lastmod>2023-02-13</lastmod>
|
<lastmod>2023-02-13</lastmod>
|
||||||
</sitemap>
|
</sitemap>
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-OtherDataObject/1</loc>
|
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-OtherDataObject/1</loc>
|
||||||
<lastmod>2023-02-13</lastmod>
|
<lastmod>2023-02-13</lastmod>
|
||||||
</sitemap>
|
</sitemap>
|
||||||
</sitemapindex>
|
</sitemapindex>
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?xml-stylesheet type='text/xsl' href='http://localhostsitemap.xml/styleSheetIndex'?>
|
<?xml-stylesheet type='text/xsl' href='http://localhost/sitemap.xml/styleSheetIndex'?>
|
||||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1</loc>
|
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/1</loc>
|
||||||
<lastmod>2023-02-13</lastmod>
|
<lastmod>2023-02-13</lastmod>
|
||||||
</sitemap>
|
</sitemap>
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/2</loc>
|
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/2</loc>
|
||||||
<lastmod>2023-02-13</lastmod>
|
<lastmod>2023-02-13</lastmod>
|
||||||
</sitemap>
|
</sitemap>
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>http://localhostsitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/3</loc>
|
<loc>http://localhost/sitemap.xml/sitemap/Wilr-GoogleSitemaps-Tests-Model-TestDataObject/3</loc>
|
||||||
<lastmod>2023-02-13</lastmod>
|
<lastmod>2023-02-13</lastmod>
|
||||||
</sitemap>
|
</sitemap>
|
||||||
</sitemapindex>
|
</sitemapindex>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?xml-stylesheet type='text/xsl' href='http://localhostsitemap.xml/styleSheetIndex'?>
|
<?xml-stylesheet type='text/xsl' href='http://localhost/sitemap.xml/styleSheetIndex'?>
|
||||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
<sitemap>
|
<sitemap>
|
||||||
<loc>http://localhostsitemap.xml/sitemap/GoogleSitemapRoute/1</loc>
|
<loc>http://localhost/sitemap.xml/sitemap/GoogleSitemapRoute/1</loc>
|
||||||
</sitemap>
|
</sitemap>
|
||||||
</sitemapindex>
|
</sitemapindex>
|
||||||
|
Loading…
Reference in New Issue
Block a user