MySql update query - Update column by string replacement in all records
Problem Statement In a mysql table, I wanted to replace the hostname of the…
October 07, 2017
I was using On page optimization of the article pages, and found that meta description value was exceeding the maximum 160 character limit. Then, my struggle started to find a way to limit this description limit. And, I found a solution.
And, in my metatag setting, I have set the value of Meta description to:[node:summary] token. Which was perfectly being replaced with the content of my article text. But, the problem was that it was coming out way more than 160 characters.
The drupal code actually put everything till first text break(paragraph break) into summary field.
I didn’t want to write custom code for this, which I could. But, drupal best practices says, that we should not change code of Core modules. Rather do an override kind of stuff. So, I was looking for some hooks, and override methods which can help me.
I saw this code for summary:
$trim_length = $instance['display']['teaser']['settings']['trim_length'];
So, this shows that the code was getting the max length value from teaser display settings.
Then, click on setting button for Body. In my case, it was 600. I changed it to 160. And, Voila.
To test, just view the pages. You will not need to update(edit/save) them.
Enjoy.
Problem Statement In a mysql table, I wanted to replace the hostname of the…
See the code below: The output will be 4 columns separated by comma. You can…
Introduction We will see how we can install Python 3.7 on Windows without UI. i…
Introduction If you working on a github project in a team. Consider you have…
So, here we are using input variable String[] args without any validation…
Thanks for reading.
Introduction Strapi is a backend system provides basic crud operations with…
Introduction I had to create many repositories in an Github organization. I…
Introduction I was trying to download some youtube videos for my kids. As I have…
Introduction In this post, we will explore some useful command line options for…
Introduction In this post, we will see how we can apply a patch to Python and…
Introduction We will introduce a Package Manager for Windows: . In automations…