Commit 59aef40b authored by gbyte.co's avatar gbyte.co

Make changes to readme file and prettify sitemap entity page.

parent 65397c0d
...@@ -5,6 +5,7 @@ CONTENTS OF THIS FILE ...@@ -5,6 +5,7 @@ CONTENTS OF THIS FILE
* Installation * Installation
* Configuration * Configuration
* Usage * Usage
* Extending the module
* How Can You Contribute? * How Can You Contribute?
* Maintainers * Maintainers
...@@ -15,16 +16,17 @@ INTRODUCTION ...@@ -15,16 +16,17 @@ INTRODUCTION
Author and maintainer: Pawel Ginalski (gbyte.co) https://www.drupal.org/u/gbyte.co Author and maintainer: Pawel Ginalski (gbyte.co) https://www.drupal.org/u/gbyte.co
The module generates a multilingual XML sitemap which adheres to Google's new The module generates a multilingual XML sitemap which adheres to Google's new
hreflang standard. Out of the box the sitemap is able to index the following hreflang standard. Out of the box the sitemap is able to index most of Drupal's
content: content entity types including:
* nodes * nodes
* taxonomy terms * taxonomy terms
* menu links * menu links
* users * users
* custom links * ...
* commerce products
* possibly other contributed entities Contributed entity types like commerce products or media entities can be indexed
as well. On top of that custom links can be added to the sitemap.
To learn about XML sitemaps, see https://en.wikipedia.org/wiki/Sitemaps. To learn about XML sitemaps, see https://en.wikipedia.org/wiki/Sitemaps.
...@@ -43,20 +45,23 @@ The module permission 'administer sitemap settings' can be configured under ...@@ -43,20 +45,23 @@ The module permission 'administer sitemap settings' can be configured under
/admin/people/permissions. /admin/people/permissions.
Initially only the home page is indexed in the sitemap. To include content into Initially only the home page is indexed in the sitemap. To include content into
the sitemap, visit the corresponding entity bundle edit pages, e.g. the sitemap, visit /admin/config/search/simplesitemap/entities to enable support
for entity types of your choosing. Entity types which feature bundles can then
be configured on a per-bundle basis, e.g.
* /admin/structure/types/manage/[content type] for nodes, * /admin/structure/types/manage/[content type] for nodes
* /admin/structure/taxonomy/manage/[taxonomy vocabulary] for taxonomy terms, * /admin/structure/taxonomy/manage/[taxonomy vocabulary] for taxonomy terms
* /admin/structure/menu/manage/[menu] for menu items, * /admin/structure/menu/manage/[menu] for menu items
* /admin/config/people/accounts for users * ...
When including an entity bundle into the sitemap, the priority setting can be When including an entity type or bundle into the sitemap, the priority setting
set which will set the 'priority' parameter for all entities of that type. See can be set which will set the 'priority' parameter for all entities of that
https://en.wikipedia.org/wiki/Sitemaps to learn more about this parameter. type. See https://en.wikipedia.org/wiki/Sitemaps to learn more about this
parameter.
Inclusion and priority settings of bundles can be overridden on a per-entity Inclusion and priority settings of bundles can be overridden on a per-entity
basis. Just head over to a bundle instance edit form (node/1/edit) and override basis. Just head over to a bundle instance edit form (e.g. node/1/edit) to
the bundle settings there. override its sitemap settings.
If you wish for the sitemap to reflect the new configuration instantly, check If you wish for the sitemap to reflect the new configuration instantly, check
'Regenerate sitemap after clicking save'. This setting only appears if a change 'Regenerate sitemap after clicking save'. This setting only appears if a change
...@@ -97,8 +102,8 @@ link array. ...@@ -97,8 +102,8 @@ link array.
HOW CAN YOU CONTRIBUTE? HOW CAN YOU CONTRIBUTE?
----------------------- -----------------------
* Report any bugs, feature or support requests in the issue tracker, if possible * Report any bugs, feature or support requests in the issue tracker, if
help out by submitting patches. possible help out by submitting patches.
http://drupal.org/project/issues/simple_sitemap http://drupal.org/project/issues/simple_sitemap
* Do you know a non-English language? Help translating the module. * Do you know a non-English language? Help translating the module.
...@@ -114,3 +119,4 @@ MAINTAINERS ...@@ -114,3 +119,4 @@ MAINTAINERS
Current maintainers: Current maintainers:
* Pawel Ginalski (gbyte.co) - https://www.drupal.org/u/gbyte.co * Pawel Ginalski (gbyte.co) - https://www.drupal.org/u/gbyte.co
* Sam Becker (Sam152) - https://www.drupal.org/u/sam152
...@@ -41,19 +41,24 @@ class SimplesitemapEntitiesForm extends ConfigFormBase { ...@@ -41,19 +41,24 @@ class SimplesitemapEntitiesForm extends ConfigFormBase {
$form['simple_sitemap_entities']['entities'] = array( $form['simple_sitemap_entities']['entities'] = array(
'#title' => t('Sitemap entities'), '#title' => t('Sitemap entities'),
'#type' => 'fieldset', '#type' => 'fieldset',
'#markup' => '<p>' . t("Simple XML sitemap settings will be added only to entity forms of entity types enabled here. For all entity types featuring bundles (e.g. node) inclusion settings have to be set on their bundle pages (e.g. 'page'). Disabling an entity type on this page will irreversibly delete its sitemap settings including per-entity overrides.") . '</p>', '#markup' => '<p>' . t("Simple XML sitemap settings will be added only to entity forms of entity types enabled here. For all entity types featuring bundles (e.g. <em>node</em>) inclusion settings have to be set on their bundle pages (e.g. <em>page</em>). Disabling an entity type on this page will delete its sitemap settings including per-entity overrides.") . '</p>',
); );
$sitemap_entity_types = Simplesitemap::getSitemapEntityTypes(); $entity_type_labels = [];
foreach (Simplesitemap::getSitemapEntityTypes() as $entity_type_id => $entity_type) {
$entity_type_labels[$entity_type_id] = $entity_type->getLabel() ? : $entity_type_id;
}
asort($entity_type_labels);
$entity_types = $sitemap->getConfig('entity_types'); $entity_types = $sitemap->getConfig('entity_types');
$f = new Form(); $f = new Form();
foreach ($sitemap_entity_types as $entity_type_id => $entity_type) { foreach ($entity_type_labels as $entity_type_id => $entity_type_label) {
$entity_type_label = $entity_type->getLabel() ? : $entity_type_id;
$entity_type_enabled = isset($entity_types[$entity_type_id]); $entity_type_enabled = isset($entity_types[$entity_type_id]);
$form['simple_sitemap_entities']['entities'][$entity_type_id] = [ $form['simple_sitemap_entities']['entities'][$entity_type_id] = [
'#type' => 'fieldset', '#type' => 'details',
'#title' => $entity_type_label, '#title' => $entity_type_label,
'#open' => $entity_type_enabled,
]; ];
$form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled'] = [ $form['simple_sitemap_entities']['entities'][$entity_type_id][$entity_type_id . '_enabled'] = [
'#type' => 'checkbox', '#type' => 'checkbox',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment