Problem/Motivation
Index now does not use alias in hook entity create
Steps to reproduce
1. Currently the index now module indexes the content/taxonomy on below triggers:
· When content/taxonomy gets created:
o In this case the module hits the search engine index with URL as :
node/node_id OR term/term_id instead of using alias.
· When content/taxonomy gets updated:
o In this case the module hits the search engine index with URL as an alias only.
I understand that alias is not created while creating a node/term may be that's why alias is not used,
i was trying some fixes for it like
Solution: For the scenario : When content/taxonomy gets created,
we can programmatically create URL alias
Issues:
o Since there are variety of path auto patterns set for each content type and taxonomy vocabulary.,
o There may be various tokens being used within these URL alias patterns.
o Apart from this there are some configurations provided by CMS on the fly like converting spaces to - in alias. Transliterate prior to creating alias, change to lowercase etc
o We will have to write a custom code to generate aliases while creating each node type, and taxonomy term type, and handle the above points by custom code.
OR
Is it just a good to have? : For now only while creating content, we are passing the Drupal node/term path instead of alias, and search engines can easily crawl these paths and will be redirected to aliases. So just to save 301 redirects it seems we are doing a lot of custom code if we implement this feature?
Does it really matters if we use a path like www.example.com/node/123 OR www.example.com/topics/mypagewhichhasnodeid-123
I mean the soul purpose of index now is to help search engine crawl urls, but i have no idea if feeding a node/123 kinda url will have any impact whatsoever in crawling OR improving ranking of site etc.
Please let me know, and we can close this straightaway if this feature has no purpose served.
Thanks
Issue fork index_now-3397964
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
macsim commentedHi @saurabh.tripathi.cs
I am sorry I don't have the required skills to answer your questions. But I would say that it would be better to send the URL alias rather than the routing path.
We can try to use the hook_module_implements_alter() to reorder the implementing modules of hook_node_insert() hook_taxonomy_term_insert(), etc.
Index Now module will then act after Pathauto and the URL alias should be available
Edit: it's not that easy cause pathauto is using
hook_entity_insert()whereas we are usinghook_ENTITY_TYPE_insert()for nodes, taxonomy_terms and commerce products.Since it's not the same hook, I can't tell him to reorder index_now after pathauto.
Comment #3
macsim commentedComment #8
macsim commentedComment #9
macsim commented