loadsys / cakephp-sitemap Goto Github PK
View Code? Open in Web Editor NEWGenerate HTML and XML sitemaps for your CakePHP application.
License: MIT License
Generate HTML and XML sitemaps for your CakePHP application.
License: MIT License
Sorry for the next issue.
Say I have 100 pages with the slug keyword of "potatoes"
When I run the sitemap there are 100 of these in the sitemap, how would I limit it to unique entries only?
Hi!
I found problem in index.ctp (/loadsys/cakephp_sitemap/src/Template/Sitemaps/xml/index.ctp).
The XML file report 500 error in first line because on my host PHP short tags is enabled.
I have simple solution because I can't off short tags on my host. Put it below.
BEFORE
<?xml version="1.0" encoding="UTF-8"?>
AFTER
<?= '<?xml version="1.0" encoding="UTF-8"?>'; ?>
I started to work with Cake PHP new. This package has insufficient usage documentation. I could not run the sample code shown. Is there anything that can help me with this? Cake PHP version 3.x
Thank you.
I used the Docs to install and configure it. My very simple Question is how to view it, the Plugin/config/routes.php let me guess it is Domain/sitemap oder /sitemap.xml , but this just shows:
Documentation API
Error: SitemapController could not be found.
Error: Create the class SitemapController below in file: src/Controller/SitemapController.php
Hello,
I'm trying to implement your plugin with some modifications in layout and also I want to enable it for the users who are not authenticated.
1. Auth allowing
If I put the beforeFilter function to the Sitemap plugin's controller -SitemapsController.php- and I define that the index action should be allowed for all unauthorized users...
public function beforeFilter(Event $event)
{
$this->Auth->allow(
'index'
);
return parent::beforeFilter($event);
}
...then it works correctly. But of course I don't want to modify the files in the vendor folder, so my questions is: Is there a way to set this in my application? I tried to put this to my AppController.php:
$this->Auth->allow(
'Sitemap.index'
);
But it doesn't seems to work.
2. Custom template
I read and tried to implement this according to the official CakePHP docs, but obviously I'm doing something wrong. I tried different paths, but they all failed:
src/Template/Plugin/loadsys/Sitemap/Sitemaps/xml/index.ctp
src/Template/Plugin/loadsys/Cakephp_sitemap/Sitemaps/xml/index.ctp
src/Template/Plugin/Loadsys/Cakephp_sitemap/Sitemaps/xml/index.ctp
src/Template/Plugin/Loadsys/CakephpSitemap/Sitemaps/xml/index.ctp
Of course, non of these worked.
Hi,
I use this code to generate my links:
Router::connect(
'/offers/:slug-:id',
array('controller' => 'offers', 'action' => 'view'),
array(
'pass' => array('id', 'slug'),
'id' => '[0-9]+'
));
Basically it works by going /offers/this-is-a-link-66
At the minute all my sitemap shows is
/offers/view/226
How would I go about changing it? I think it would be this line :
'loc' => 'buildUrl'
To follow convention, this package should probably be named loadsys/cakephp-sitemap
.
This might have an impact on package consumers and warrants further consideration before implementing.
I've just forked your plugin in order to fix #37 and when I run de code sniffer, it crashes with three errors and 4 warnings.
I installed the plugin via composer - added the behavior etc.
I am missing the docu how to view any of this. Could you add this to the readme?
It would be awesome if this plugin could also generate the compressed version of the sitemap (sitemap.xml.gz
).
Hi ad,
I has add Sitemap plugin into my site,
I can generate site map success, but all router on my site become error
after i add your plugin i still can access site /controller/action/param
but Router not working for me
If i remove your plugin then Router working ok for me
Please confirm this issues!
Given our recent uptick of composer usage, the Vendor directory is increasingly becoming a location that should be "hands off."
I suggest moving the Vendor/Iterators/
folder to Lib/Iterators/
in order to avoid future conflicts.
Update the documentation and comments, etc.
Got this exception trying to install on CakePHP 3.2+
`Generating autoload files
Cake\Composer\Installer\PluginInstaller::postAutoloadDump
Script Cake\Composer\Installer\PluginInstaller::postAutoloadDump handling the post-autoload-dump event terminated with an exception
Installation failed, reverting ./composer.json to its original content.
[RuntimeException]
Unable to get primary namespace for package loadsys/cakephp_sitemap.
Ensure you have added proper 'autoload' section to your plugin's config as
stated in README on https://github.com/cakephp/plugin-installer
`
Is there any way to fix this ?
It seems the plugin has some trouble loading table classes from plugins. There also isn't a test case for this.
I configured as follows,
Configure::write('Sitemap.tables', [
'Gaia/Matter.Contents'
]);
Yet, when I hit /sitemap.xml
I get the following.
<?xml version="1.0" encoding="UTF-8"?>
<response>
<message>Call to a member function find() on boolean</message>
<url>/sitemap.xml</url>
<code>500</code>
<file>/vendor/loadsys/cakephp_sitemap/src/Controller/SitemapsController.php</file>
<line>29</line>
</response>
I think the issue is the way that the loaded table instance is used based on the string of the table name. As plugin and namespaced table names are aliased differently.
I'll see if I can solve it and submit a pull request.
In some of the code the path to the lib files needs to be changed from vendor :)
It would be very nice to have an option to add hand-picked links. In my case, the home page does not directly depend from an entity and I would like to add it to the generated sitemap.xml
file.
I guess that using an array in the Sitemap
configuration like this one:
'handpicked' => [
[
'route' => ['_name' => 'my_route'],
'changefreq' => 'weekly',
'priority' => 0.7
]
]
$routes->extensions(['xml']);
For >
$routes->setExtensions(['xml']);
Sitemaps specification says there are limits for sitemap.xml
files:
This plugin should manage them somehow.
More details: https://support.google.com/webmasters/answer/183668?hl=en&topic=8476&ctx=topic
It would be nice to automatically add language variants with SitemapBehavior
. The translate behavior could be detected and then, with a call to the i18n
table get all the available languages.
Here you can see how alternate language pages must be specified in a sitemap file:
Excluding the loadsys_codesniffer
(which must avoid dashes in the filesystem path), our Packagist packages follow a naming convention of using dashes in the package name: https://packagist.org/packages/loadsys/
It would only be a superficial improvement to convert the name to match and might cause problems for any consuming projects (are there any that we should be concerned with) to change the package name.
Only if the impact is low would this be worth doing after the fact (now).
Updated here:
to pass the full Model find options array as opposed to just conditions.Warning (2): array_key_exists() expects parameter 2 to be array, null given [APP/Plugin/Sitemap/Controller/SitemapsController.php, line 74]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.