Giter Club home page Giter Club logo

prestasitemapbundle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prestasitemapbundle's Issues

Attempted to call an undefined method named "getGenerator"

Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedMethodException: "Attempted to call an undefined method named "getGenerator" of class "Presta\SitemapBundle\Event\SitemapPopulateEvent"." at /var/www/website/src/BlogBundle/EventListener/SitemapListener.php line 42 {"exception":"[object](Symfony\Component\Debug\Exception\UndefinedMethodException%28code: 0%29: Attempted to call an undefined method named "getGenerator" of class "Presta\SitemapBundle\Event\SitemapPopulateEvent". at /var/www/aramido.de/src/BlogBundle/EventListener/SitemapListener.php:42)"} []

Can you please advise?

Allow all entries to be in the main sitemap.xml

It seems I must have at least two files, sitemap.xml and sitemap.default.xml, although the default part can be changed.

However, I couldn't find a way to put everything in sitemap.xml.

For small sites it seems unnecessary to have the two different files (and two HTTP requests needed to read them). Is there any benefit in having a config item to force everything into the main sitemap.xml?

How to handle sections?

I hope I'm not asking a dumb question, but I couldn't find how to generate a sitemap for a specific section.
I'm calling URL /sitemap.foo.xml to get a "foo" section (I configurated my listener for it) but I get a 404.
I see that controller calls generator's fetch method, that calls generate method without passing $name.
I also tried to add $name = null to generate() and everything works. Is it a bug or am I doing it wrong?

Release new version

Can you, please, release new version of PrestaSitemapBundle (tag current master branch)?

The latest stable version is one year old.

SitemapListenerInterface is redurant

There is no sense implement SitemapListenerInterface and create additional tag like presta.sitemap.listener. We could just subscribe for SitemapPopulateEvent::ON_SITEMAP_POPULATE and it enough. As additional feature - we can set priority in this case.

Recursive removes of old sitemaps are very slow

Dumper::deleteExistingSitemaps() uses Finder class for find existing sitemaps (https://github.com/prestaconcept/PrestaSitemapBundle/blob/master/Service/Dumper.php#L226). But Finder does recursive search of sitemaps and boes it slowly, if there are many dirs in the targetDir.

Command time php bin/console presta:sitemaps:dump web executes for 2.6 sec, but command time php bin/console presta:sitemaps:dump web/subdir executes for 0.6 sec. (I have 7 sections in the sitemap.) This 2.0 secs spent on find of existing sitemaps in Dumper::deleteExistingSitemaps().

If I copy one of generated sitemaps into subdir of web (e.g. into /web/bundles/framework/css/), then this file will be removed after generate sitemaps. But is this behavior normal? What if I have sitemap.somefile.xml in other my subdirs of web dir? I think that remove of existing sitemaps need performs in the targetDir directory only.

Custom router service

Presta\SitemapBundle\Service\Generator should accept a RouterInterface or at least a UrlGeneratorInterface in order to use custom router service (cf. CMF)

EventListener & Command Line Dumper

Could you please provide more info how to setup EventListener & Dumper Command?

I did everything exactly as written in documentation: https://github.com/prestaconcept/PrestaSitemapBundle/blob/master/Resources/doc/5-Usage-Event_Listener.md

But everytime ir run:
php app/console presta:sitemaps:dump

get error:

No URLs were added to sitemap by EventListeners - this may happen when provided section is invalid

How can I attach event listener that it would be executed?

enclose fields in cdata

Certain fields must be enclosed before rendered in xml (eg. description in GoogleVideoUrlDecorator)

mkdir fail

Hi !

Why do you need to create a new folder ?

Please have a look on the trace :

[2016-07-04 15:00:01] event.DEBUG: Notified event "presta_sitemap.populate" to listener "Cdp\Bundle\FrontBundle\EventListener\SitemapListener::populateSitemap". \n\n \n [Symfony\Component\Debug\Exception\ContextErrorException] \n Warning: mkdir(): Permission denied \n \n\nException trace:\n () at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/presta/sitemap-bundle/Service/Dumper.php:190\n Symfony\Component\Debug\ErrorHandler->handleError() at n/a:n/a\n mkdir() at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/presta/sitemap-bundle/Service/Dumper.php:190\n Presta\SitemapBundle\Service\Dumper->activate() at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/presta/sitemap-bundle/Service/Dumper.php:114\n Presta\SitemapBundle\Service\Dumper->dump() at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/presta/sitemap-bundle/Command/DumpSitemapsCommand.php:94\n Presta\SitemapBundle\Command\DumpSitemapsCommand->execute() at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/symfony/symfony/src/Symfony/Component/Console/Command/Command.php:259\n Symfony\Component\Console\Command\Command->run() at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:860\n Symfony\Component\Console\Application->doRunCommand() at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:192\n Symfony\Component\Console\Application->doRun() at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:92\n Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/comptoirdesplats.fr/public_html/cdp/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:123\n Symfony\Component\Console\Application->run() at /var/www/html/comptoirdesplats.fr/public_html/cdp/app/console:28\n\npresta:sitemaps:dump [--section SECTION] [--gzip] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--] []\n\n"}

Breaking change in minor version

Hi,

I just wanted to mention that there's a breaking change when migrating 1.4.2 -> 1.5.0 (I got this: Call to undefined method Presta\SitemapBundle\Event\SitemapPopulateEvent::getGenerator()).
So this project is not following semantic versioning, it would probably make sense to set it to version 2.0 then as people normally do not expect to change anything in their code when updating minor version.

Prepare 2.0

As this bundle is pretty old we need to refactor it and prepare a 2.0 release.

In this issue we will plan all the main changes we want to put in it.

Community is more than welcome to share their idea.

Lead developer for this release will be @yann-eugone

Support sitemap=false annotation

It's currently not supported to set the sitemap option to "false".

Presta/SitemapBundle/EventListener/RouteAnnotationEventListener.php line 97 {"exception":"[object] (InvalidArgumentException: the sitemap option must be "true" or an array of parameters at /home/www/wwwroot/sf2_widge_prod/shared/vendor/presta/sitemap-bundle/Presta/SitemapBundle/EventListener/RouteAnnotationEventListener.php:97

That's bad style. It shoudl accept the values true and false and the sitemap parameters as an additional parameter.

Revise deprecated pattern option on routing file

  The "pattern" option in file "/private/var/www/ojs/vendor/presta/sitemap-bundle/Presta/SitemapBundle/Resources/config/routing.yml" is deprecated since version 2.2 and will be removed in 3.0. Use the "path" option in the route definition instead. {"type":16384,"file":"/private/var/www/ojs/vendor/symfony/symfony/src/Symfony/Component/Routing/Loader/YamlFileLoader.php","line":85,"level":28928} 

Memory limit exhausted

Hi I'm generating really BIG sitemap and i still have Allowed memory size exhausted.

Is there any option to create sitemaps partially and to not store the all urls in memory?

Allow changing default change frequency

If most of the URLs on our site are changed weekly, it would be nice to be able to specify a config like this:

presta_sitemap:
    default_changefreq: weekly

That way, we can cut down most of our routing.yml entry options from:

options:
    sitemap: { priority: 0.5, changefreq: weekly }

to

options:
    sitemap: { priority: 0.5 }

Allow a custom generator service

It would be great if I could build my own sitemap generator and use that instead of the default sitemap generator. Configuration might look like this:

# app/config/config.yml
presta_sitemap:
    generator: my_app.sitemap_generator # service id of my sitemap generator

To support this, a GeneratorInterface should be created that should be implemented by the generator.
A few reasons for building your own sitemap generator:

  • Custom caching implementation
  • Reduce memory usage (like the DumperGenerator)
  • etc.

RfC: yaml support for static routes

Hi

I'm defining routes in yaml files. Would be great if I could add a sitemap=true option to these static routes to add them automatically to my generated sitemap.

I'm not sure if this bundle is still maintained.

BR
ninsky

Release new version

Can you, please, release new version of PrestaSitemapBundle (tag current master branch)?

The latest stable version is more than one year old.

How to use dumper from controller?

I want to dump a new item to sitemap after creating of new entity (e.g. page or product). But now Dumper service has very complex method dump(), which needs arguments $targetDir and $baseUrl.

I want more simple dump(), which will use default values:

    $this->get('presta_sitemap.dumper')->dump(); // all sections
    $this->get('presta_sitemap.dumper')->dump('articles'); // section 'articles'

Add cookbook entry how to generate different sitemaps for subdomains

We have large amount of subdomains and need to generate different sitemaps for each one. Cuttently we have created one listener like this:

list($section, $subdomain) = explode('_', $event->getSection());
if ($section === 'multisite') {
  // generate urls for $subdomain
}

and bash

php app/console p:s:d --section=multisite_domain1
php app/console p:s:d --section=multisite_domain2
# ... many lines

How it possible do it better?

Annotated routes don't show in sitemap

In a symfony 2.8 installation, I have the bundle configured as:

config.yml

presta_sitemap:
   route_annotation_listener: true

routing.yml

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

company_dweh:
    resource: "@CompanyDwehBundle/Controller"
    type: annotation

PrestaSitemapBundle:
    resource: "@PrestaSitemapBundle/Resources/config/routing.yml"
    prefix:   /

And in my controller:

<?php

namespace Company\DwehBundle\Controller;

use APY\BreadcrumbTrailBundle\Annotation\Breadcrumb;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

/**
 * @Route("/")
 * @Breadcrumb("Home", route={"name"="company_dweh_default_index"})
 */
class DefaultController extends Controller
{
    /**
     * @Route("", options={"sitemap" =  true })
     */
    public function indexAction()
    {
        return $this->render('CompanyDwehBundle:Default:index.html.twig', array());
    }
}

But, after clearing the cache, the route doesn't appear in the sitemap:


<?xml version="1.0" encoding="UTF-8"?>
    <sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>http://dweh.swdev.company.nl/app_dev.php/sitemap.default.xml</loc>
        <lastmod>2016-04-04T16:00:41+02:00</lastmod>
    </sitemap>
</sitemapindex>

I've tried the annotation like this with the same result:

<?php

namespace Company\DwehBundle\Controller;

use APY\BreadcrumbTrailBundle\Annotation\Breadcrumb;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

/**
 * @Breadcrumb("Home", route={"name"="company_dweh_default_index"})
 */
class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage", options={"sitemap" = true})
     */
    public function indexAction()
    {
        return $this->render('CompanyDwehBundle:Default:index.html.twig', array());
    }
}

What could I be missing?

Abiltiy to disable built-in event listener?

Can/should there be a config switch to disable the built-in event listener service?

It's possible I'm a little confused about how event listeners should be used alongside the existing one. The service presta_sitemap.eventlistener.route_annotation is already registered, and it seems if I follow the docs and create my own listener, this pre-existing one is still used.

For now I have been able to work around it by overriding the service class:

parameters:
    presta_sitemap.eventlistener.route_annotation.class: Acme\MyBundle\EventListener\SitemapEventListener

However, I subsequently wanted to change the service definition (see PR #67) to inject the request_stack service. If I make my own service definition, I'm back to the original problem - the built-in event listener still fires. I needed to create a compiler pass class (see the compiler pass docs).:

class SitemapCompilerPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        if ($container->hasDefinition('presta_sitemap.eventlistener.route_annotation')) {
            $container
                ->getDefinition('presta_sitemap.eventlistener.route_annotation')
                ->addArgument(new Reference('request_stack'));
        }
    }
}

Alternatively, I could have used the compiler pass to remove the built-in service, making way for my own one. Either way, it's extra code in my project. ;)

So I'm wondering if there should be a config item 'event_listener_enabled' (default true) or similar?

If so, I don't mind doing a PR; I guess it's a case of dynamically creating that service in PrestaSitemapExtension, or adding a compiler pass in your bundle to remove the service when a config switch says so (that way you get to keep the definition file route_annotation_listener.xml where it's easier to see and modify).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.