SEO – Google can not retrieve a large sitemap with 50,000 URLs and is not rendered by browsers

My sitemap contains 50,000 URLs / 7.8 MB and the following URL syntax:




 https://www.ninjogos.com.br/resultados?pesquisa=vestido, maquiagem,   2019-10-03T17:12:01-03:00 
 1.00 


The problems are:

• The search console reports that the sitemap could not be read.

• Sitemap loading takes 1 hour and Chrome stops working.

Enter image description here

• In Firefox, the sitemap was downloaded in 1483 ms and fully loaded after 5 minutes.

Things that I have done without success:

• Disable GZip compression.

• Delete my .htaccess file;

• Create a test sitemap with 1 KB URLs and the same syntax, and send it to Search Console. However, the sitemap with 50 KB URLs still displays "" that no sitemap can be retrieved.

Enter image description here

• An attempt was made to directly check the URL, but an error occurred and you are asked to try again later while the 1KB URLs worked.

• An attempt was made to validate the sitemap on five different websites (YANDEX, ETC), and all worked without error / warning

Any light?

8 – How to set or change which user or role is referenced when an entity is rendered programmatically?

I have a situation where I have to render a node entity programmatically. I need to get the version of the node that will be displayed to anonymous users, but the rendering will be triggered by an authenticated user. Is there any idea how to specify or change which user (or ideally what role) is referenced when the entity is rendered?

Put simply, here is the rendering code:

$node = Node::load(1);
$render_controller = Drupal::entityTypeManager()->getViewBuilder('node');
$render_output = $render_controller->view($node);
return $render_output;

This renders the entire page. When this code section is triggered by an administrator, the rendered page includes the management toolbar, context tabs, and the like. I want to be able to render what an anonymous user would see.

SEO – Does rendered HTML from an angular app have to be nicely designed if it is only shown to search engine bots?

I have a square app, and while Google indexes it now, many other sites do not.

I have created middleware that crawls requests from crawlers and provides HTML pages that these crawlers can use to index.

My question is this. Since people do not see these pages, I have to make them pretty with CSS and follow the same theme as my website, or can I simply use basic HTML to get the content I need out there. Will basic HTML ever affect SEO?

The main page in question are jobs that our company publishes on a job page. We want these jobs to be indexed. So can I just have a simple HTML page with all job details?

Error – CSS and JS are not rendered from the pub / static folder after installing Magento 2.2.8

I have just installed Magento 2.2.8 and there is an error on a homepage

magento 2 homepage error

then I executed the following commands

php -dmemory_limit=6G bin/magento setup:static-content:deploy -f
php bin/magento cache:clean

But nothing has changed how to fix this error? why magento 2.2.8 does not take pub / static path for images, css and js files?

8 – Display the rendered node in jQuery Modal via JSON

I want to be able to have a link, and if there is a specefic class, I want to display it as a jQuery modal. I added the required data associated with the link to be able to use it as a modal.

I also created a route for nodes that has a custom controller that runs when a node is displayed ?_format=json, The controller returns the rendered node as JSON, which seems to work well.

Here is my controller:

public function json(EntityInterface $node, $view_mode = 'full', $langcode = NULL) {
  $build = $this->entityTypeManager->getViewBuilder('node')->view($node, $view_mode);
  $output = $this->renderer->renderRoot($build);

  return new JsonResponse($output);
}

And here's the JS that makes the link to a modal:

if ($(context).find('.node-open-modal').length > 0) {
  $(context).find('.node-open-modal').each(function () {
    $(this).attr('data-dialog-type', 'modal').addClass('use-ajax');
  });
}

The only problem is that clicking the link will cause the following error message:

SyntaxError: JSON.parse: Unexpected character in line 2, column 1 of the JSON data

Does Drupal not send valid JSON data or what?

7 – How are translated nodes rendered in two languages?

I use entity_translation to translate the node body field, that is, a fully loaded node object body is an array of 2 languages ​​(& # 39; and & # 39; ru & # 39;).

For a specific node type, I would like to render body sequentially in both languages:

Russian version of the node body

English version of the node body

A change between the translations is therefore not required.

Which hook can I use to achieve this?

In implementation of hook_node_load() body is an array of 2 languages, but in hook_node_view_alter() body already contains only the current language value.

When using node_load() in the hook_preprocess_nodeGets the node object from the cache and its body has only one (current) language value.

8 – How do I create a token of the rendered entity of the author?

I have a site with Drupal 8 and the Message and Token modules.

I have created custom tokens for my custom module based on the message module. Here is the file I added to my module:

message_activity_stream.tokens.inc

    t (& # 39; message activity stream & # 39;),
& # 39; description & # 39; => t (& # 39; tokens for the Message Activity Stream module. & # 39;),
& # 39; # 39 &-data needs; => & # 39; message & # 39 ;,
];

// user relationship token.
$ message['author-render'] = [
    'name' => t("Rendered author"),
    'description' => t("The related author rendered to HTML."),
  ];

// Save related tokens.
$ message['store-render'] = [
    'name' => t("Rendered store"),
    'description' => t("The related store rendered to HTML."),
  ];

// Product-related tokens.
$ message['product-render'] = [
    'name' => t("Rendered product"),
    'description' => t("The related product rendered to HTML."),
  ];

// group-related tokens.
$ message['group-render'] = [
    'name' => t("Rendered group"),
    'description' => t("The related group rendered to HTML."),
  ];

// node-related tokens.
$ message['node-render'] = [
    'name' => t("Rendered node"),
    'description' => t("The related node rendered to HTML."),
  ];

return [
    'types' => ['message' => $type].
& # 39; token & # 39; => [
      'message' => $message,
    ].
];
}

/ **
* Implemented hook_tokens ().
* /
function message_activity_stream_tokens ($ type, $ tokens, array $ data = [], array $ options = []) {
$ token_service =  Drupal :: token ();

$ url_options = ['absolute' => TRUE];
if (isset ($ options['langcode'])) {
$ url_options['language'] =  Drupal :: languageManager () -> getLanguage ($ options['langcode']);
$ langcode = $ options['langcode'];
}
otherwise {
$ langcode = NULL;
}
$ sanitize =! empty ($ options['sanitize']);

$ replacements = [];

if ($ type == & # 39; message & # 39; &&! empty ($ data['message'])) {
/ ** @var  Drupal  message  Entity  Message $ message * /
$ message = $ data['message'];

foreach ($ tokens as $ name => $ original) {
switch ($ name) {
// Simple key-values ​​in the comment.
case & # 39; author-render & # 39 ;:
$ entity = $ message-> getOwner ();
$ view_builder =  Drupal :: entityTypeManager () -> getViewBuilder ($ entity);
$ message_view = $ view_builder-> view ($ entity, & # 39; message_activity_stream & # 39;);
$ Replacement[$original] =  Drupal :: service (& # 39; renderer & # 39;) -> renderRoot ($ message_view);
break;

case & # 39; store-render & # 39 ;:
if ($ message-> bundle () == & # 39; mas_create_store & # 39;) {
$ entity = $ message-> field_store_reference-> get (0) -> entity;
}

$ view_builder =  Drupal :: entityTypeManager () -> getViewBuilder ($ entity-> getEntityTypeId ());
$ message_view = $ view_builder-> view ($ entity, & # 39; message_activity_stream & # 39;);
$ Replacement[$original] =  Drupal :: service (& # 39; renderer & # 39;) -> renderRoot ($ message_view);
break;

case & # 39; product-render & # 39 ;:
if ($ message-> bundle () == & # 39; mas_create_product & # 39;) {
$ entity = $ message-> field_product_reference-> get (0) -> entity;
}

$ view_builder =  Drupal :: entityTypeManager () -> getViewBuilder ($ entity-> getEntityTypeId ());
$ message_view = $ view_builder-> view ($ entity, & # 39; message_activity_stream & # 39;);
$ Replacement[$original] =  Drupal :: service (& # 39; renderer & # 39;) -> renderRoot ($ message_view);
break;

case & # 39; group-render & # 39 ;:
if ($ message-> bundle () == & # 39; mas_create_group & # 39;) {
$ entity = $ message-> field_group_reference-> get (0) -> entity;
}

$ view_builder =  Drupal :: entityTypeManager () -> getViewBuilder ($ entity-> getEntityTypeId ());
$ message_view = $ view_builder-> view ($ entity, & # 39; message_activity_stream & # 39;);
$ Replacement[$original] =  Drupal :: service (& # 39; renderer & # 39;) -> renderRoot ($ message_view);
break;

case & # 39; node-render & # 39 ;:
if ($ message-> bundle () == & # 39; mas_create_node & # 39;) {
$ entity = $ message-> field_node_reference-> get (0) -> entity;
}

$ view_builder =  Drupal :: entityTypeManager () -> getViewBuilder ($ entity-> getEntityTypeId ());
$ message_view = $ view_builder-> view ($ entity, & # 39; message_activity_stream & # 39;);
$ Replacement[$original] =  Drupal :: service (& # 39; renderer & # 39;) -> renderRoot ($ message_view);
break;
}
}
}

Return $ replacement;
}

It works very well, even the replacement images are displayed. But I'm going to kill Author render has generated an error:

Enter php
Date Jeudi, 18 juillet, 2019 - 02:20
user administrators
Placement https://www.example.com/fr
speaker
Message Fixed Fatal Error: Object of class Drupal  user  Entity  User could not in a string in Drupal  Core  Entity  EntityTypeManager-> getDefinition () (line 150 of / var / www / www-example-com / web) /core/lib/Drupal/Core/Entity/EntityTypeManager.php) # 0 /var/www/www-example-com/web/core/includes/bootstrap.inc(587): _drupal_error_handler_real (4096, & # 39; ; Object of class ... .., # 39; / var / www / www-s1 ... & # 39 ;, 150, array) # 1 [internal function]: _drupal_error_handler (4096, & # 39; object of class ... & # 39; / var / www / www-s1 ... & # 39 ;, 150, array) # 2 / var / www / www-example-com / web / core / lib /Drupal/Core/Entity/EntityTypeManager.php(150): sprintf (& # 39; The "% s" entity ... & # 39 ;, object (Drupal  user  Entity  User)) # 3 / var / www / www-example-DE / web / core / lib / Drupal / Core / Entity / EntityTypeManager.php (272): Drupal  Core  Entity  EntityTypeManager-> getDefinition (Object (Drupal  user  Entity  User)) # 4 / var / www / www-example-DE / web / core / lib / Drupal / Core / Entity / EntityTypeManager.php (257): Drupal  Core  Entity  EntityTypeManager-> getHandler (Object (Drupal  Users  Entity  Users), & # 39; view_builder & # 39;) # 5 /var/www/www-example-com/web/modules/custom/message_activity_stream/message_activity_stream.tokens. inc (85): Drupal  Core  Entity  EntityTypeManager-> getViewBuilder (Object (Drupal  user  Entity  User)) # 6 [internal function]: message_activity_stream_tokens (& # 39; message & # 39 ;, Array, Array, Array, Object (Drupal  Core  Render  BubbleableMetadata)) # 7 / var / www / www-example-DE / web / core / lib / Drupal / Core / Extension / ModuleHandler .php (403): call_user_func_array (& # 39; message_activit ... & # 39 ;, array) # 8 / var / www / www-example-com / web / core / lib / Drupal / Core /Utility/Token.php(304): Drupal  Core  Extension  ModuleHandler-> invokeAll (& # 39; token & # 39 ;, Array) # 9 / var / www / www-example-com / web / core / lib /Drupal/Core/Utility/Token.php(196): Drupal  Core  Utility  token-> generate (& # 39; message & # 39 ;, array, array, array, object (Drupal  Core  Render  BubbleableMetadata) ) # 10 / var / www / www-example-DE / web / modules / contrib / twig_tweak /src/TwigExtension.php(552): Drupal  Core  Utility  Token-> replace (& # 39;[message: author ... & # 39 ;, array, array) # 11 / var / www / www-example-DE / web / sites / default / files / php / twig / 5d2fb8b27bc0e_message -qYvaRDNtomwz9r9Y.php (62): Drupal  twig_tweak  TwigExtension-> drupalToken (& # 39; message: author -... & # 39 ;, Array) # 12 / var / www / www-example-com / vendor / twig / twig / src / Template. php (455): __TwigTemplate_d33192b3dbb8dddc6e03e302a586f5d15a132dc819ff276fd420c87132608ac6-> doDd (Array, Array) # 13 / var / www / ww-example / pvtv ........................ .......................... ........................ .......................... ........................ .......................... ........................ .......................... ........................ .......................... ........................ ............
Severity Erreur

react.js – Best project structure for crafted components that are rendered by multiple files

Here is my situation:

Filter.js

  • Renders a series of filter components

Filter structure:

Filter.js
parts /
PriceFilter.js
CategoryFilter.js
RatingFilter.js
etc

I use styled components. Many of these filter components use the same style elements to display. To like:

S.Filter_DIV = styled.div`
Width: 100%;
Edge-ground: 16px;
`;

S.FilterTitle_DIV = styled.div`
Font thickness: bold;
Edge-ground: 4px;
User selection: none;
`;

Where should I keep these declarations for crafted components in situations like these? Which file / folder? Many Thanks!

8 – The node view mode can not be rendered programmatically

I'm trying to render HTML data from my node view mode, but unfortunately I've made some small progress.
I have done some search and modification work on the other code here.
I have that now.

$ nid = 145;
$ entity_type = & # 39; node & # 39 ;;
$ view_mode = & # 39; pdf & # 39 ;;

$ view_builder =  Drupal :: service (& # 39; entity.manager & # 39;) -> getViewBuilder ($ entity_type);
$ storage =  Drupal :: service ('entity.manager') -> getStorage ($ entity_type);
$ node = $ storage-> load ($ nid);
$ build = $ view_builder-> view ($ node, $ view_mode);
var_dump ($ build);
to die();

But if I let it run, I got that mistake

TypeError: Argument 1 passed to Drupal Core Routing CurrentRouteMatch :: getRouteMatch () must be an instance of Symfony Component HttpFoundation Request that is null and in C: wamp64 www executive-coating docroot core is called lib Drupal Core Routing CurrentRouteMatch.php at line 127 in Drupal Core Routing CurrentRouteMatch-> getRouteMatch () (line 99 of core lib Drupal Core Routing CurrentRouteMatch. php).

When I looked up step by step, I got the problem with $ build = $ view_builder-> view ($ node, $ view_mode);

What's wrong with this code? Am I right to render HTML data from a view mode?

SEO – Get this in Google SDTT Tool: "The URL could not be rendered, some markup may be missing."

Structured Data Testing Tool that causes errors while testing from the fetch URL, but works fine when you insert the code.
I have some js code that gets some content and inserts it dynamically into the HTML.
I think that's the reason for the mistake.
However, I have inserted the generated code and it works fine there.

Can not the SDTT retrieve the dynamic content via js and return an error?
Is it a problem? because most of the site injected dynamically fetched HTML code into DOM.
Does it affect the page ranking in any way?
How to fix this error.

I created sample URLs:

This is a mistake
http://54.83.93.238/sdk/with_error.html
This is not an error:
http://54.83.93.238/sdk/without_error.html

Thanks for looking at it.