I have switched the field of the SEOmatic plugin to translateable. All the SEO Titles are taken from the entry title. After changing to translateable I can see the translated fields in the SEO Title field but I need to save the entry again to see that on the website. Until then, the title is just in one language. Why is that? Is there any way to automate that, since I have a hundreds of entries and I dont want to do that manually.
-
You can loop through all entries and re-save them in php. There are plenty examples how to save entries in the web. craftcms.stackexchange.com/questions/5385/… fetch them all like you are used to in twig and loop through them. I don't see any issues– Robin SchambachCommented Mar 8, 2018 at 11:45
1 Answer
I'm not entirely sure why you need to resave all the entries but I do know how you can do it quickly and easily. I'd recommend using the Walk plugin by Michael Rog to do this.
The plugin is pretty well-documented in the repository README, but I'll outline the steps here for you as well:
- Download the plugin folder, drop it in
/craft/plugins
, and install the plugin in the Craft CP. - Add the
yiic
file from the repository into the base folder of your Craft install (next to thecraft
folder). Open your terminal,
cd
to your Craft install, and run the following:php yiic walk entries --section=blog --limit=null entries.save
Obviously replace
blog
with the name of your section.
Hopefully that does the trick for you! Let me know if you have any questions...
-
Thanks, that sounds like a quick and easy solution. Any idea why I get this error? CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory in /Applications/MAMP/htdocs/website/craft/app/etc/behaviors/AppBehavior.php (876) in /Applications/MAMP/htdocs/website/craft/app/etc/console/ConsoleApp.php (216) in /Applications/MAMP/htdocs/website/craft/app/etc/behaviors/AppBehavior.php (80) already tried everything meanting here: craftcms.stackexchange.com/questions/7127/…– JanCommented Mar 9, 2018 at 8:54
-
@Jan yeah it sounds like it's having a hard time finding the db credentials and thereby establishing a connection. Where are you setting these - in a .env file, in your Craft config, index.php, etc?– Jalen Davenport ♦Commented Mar 9, 2018 at 15:45
-
unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock did the trick for me. Check stackoverflow.com/questions/41852050/… But the plugin didnt help yet, since I have to actually change something in the entry field so SEOmatic updates the SEO title field...– JanCommented Mar 9, 2018 at 20:43