README.md 3.34 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# Sitemap Package for big website based on Neos CMS

This package provide the infrastrucutre to build sitemap.xml for big website based on [Neos CMS](https://www.neos.io)

This package use job queue to generate a static sitemap.xml when a node path change. You can configure how the sitemap
build should work by different presets.

**Package under development, API can change at any time**

How to use ?
------------

Edit your distribution [Settings.yaml](Configuration/Settings.yaml) for configuration:

    Ttree:
      Neos:
        Sitemap:
          presets:
            default:
              include:
                'TYPO3.Neos.NodeTypes:Page': TRUE
              skip:
                'TYPO3.Neos:Shortcut': TRUE
              type: 'single'
25
              path: '%FLOW_PATH_DATA%/Persistent/Sitemaps/Sitemap.xml'
26 27

Basically you can configure the NodeType who need to be in the sitemap, and an optional list of NodeType that need to 
28 29
be skipped. Currently the package support only "single" type. In the future "multiple" will be support to generate multiple
sitemap with a single index.
30 31 32 33 34 35 36 37 38

Currently to Job Queue is not supported but you can use the CLI command::

```
FLOW_REWRITEURLS=1 ./flow sitemap:generate --site-node-name architectesch --base-url http://www.architectes.ch/ --preset default
```

__Warning__: The environnement variable ```FLOW_REWRITEURLS``` is required in CLI to have proper URI building
            
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
How to use the Job Queue feature ?
----------------------------------

When you install this package, composer will install automatically ```typo3/jobqueue-common``` so you need one of the Job Queue
adapater, like the ``typo3/jobqueue-beanstalkd```. Once your setup with, you can edit your ```Settings.yaml```:

    TYPO3:
      Jobqueue:
        Common:
          queues:
            'Default':
              className: 'TYPO3\Jobqueue\Beanstalkd\Queue\BeanstalkdQueue'
              
In this case ```Default``` is the name of the queue, edition your preset:

    Ttree:
      Neos:
        Sitemap:
          presets:
            default:
              queue: 'Default'
              include:
                'TYPO3.Neos.NodeTypes:Page': TRUE
              skip:
                'TYPO3.Neos:Shortcut': TRUE
              type: 'single'
              path: '%FLOW_PATH_DATA%/Persistent/Sitemaps/Sitemap.xml'

And create your first job:

```
FLOW_REWRITEURLS=1 ./flow sitemap:generate --site-node-name architectesch --base-url http://www.architectes.ch/ --preset default --async

# You should see one job in the queue
flow job:list --queue-name Default

# You can now process the job, this command is a long running process, use Ctrl-C to exit
flow job:work --queue-name Default
```

Check your system log at ```Data/Logs/System.log``` or ```Data/Logs/System_Development.log``` depending of your application context, 
you should see a log message saying something like: Build Request Job processed with success 

82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
What's next ?
-------------

- Implement type: "multiple", to generate multiple sitemap with one index
- Integrate with Neos.SEO package for advanced configuration per document

Acknowledgments
---------------

Development sponsored by [ttree ltd - neos solution provider](http://ttree.ch).

We try our best to craft this package with a lots of love, we are open to
sponsoring, support request, ... just contact us.

License
-------

Licensed under MIT, see [LICENSE](LICENSE)