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. https://craftcms.stackexchange.com/questions/5385/plugin-controller-save-entry fetch them all like you are used to in twig and loop through them. I don't see any issues – Robin Schambach Mar 08 '18 at 11:45
1 Answers
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
yiicfile from the repository into the base folder of your Craft install (next to thecraftfolder). Open your terminal,
cdto your Craft install, and run the following:php yiic walk entries --section=blog --limit=null entries.saveObviously replace
blogwith the name of your section.
Hopefully that does the trick for you! Let me know if you have any questions...
- 3,045
- 1
- 9
- 24
-
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: https://craftcms.stackexchange.com/questions/7127/using-yiic-for-plugin-migration
– Jan Mar 09 '18 at 08: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 Mar 09 '18 at 15:45
-
unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock did the trick for me. Check https://stackoverflow.com/questions/41852050/yii-console-command-cant-connect-to-database?rq=1
But the plugin didnt help yet, since I have to actually change something in the entry field so SEOmatic updates the SEO title field...
– Jan Mar 09 '18 at 20:43