[SmartCrawl Pro] SmartCrawl Meta Templates for homepage not working

I'm using the option for Network control, and have my homepage template to use %%sitename%%

However, when I set a static page as my homepage I'm instead seeing
%%title%% %%sep%% %%sitename%%
used for all homepages including homepages network wide.

I've tried with the 2016 theme as well as my theme of choice with no difference.

  • Ash
    • WordPress Hacker

    Hello Dan Berdal

    This is default behavior. When you select a static page, then the settings of that page meta will override the samrtcrawl settings.

    So, when a static page is selected as homepage, you need to edit that page, check smartcrawl meta box, and change the settings there:

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

  • Dan Berdal
    • Design Lord, Child of Thor

    Thanks for the reply - I need to set this up so that my single site admin don't have to mess with their SEO settings.

    I've noticed that the same merge tags %%sitename%% %%sitedesc%% etc don't work if I enter them on an individual page's SmartCrawl UI.

    So, If I'm using static homepages... which is very common... I have to manually go in and fill in the fields. I can't control at the network level, and I can't insert merge tags into my page templates.

    Are there any filters or hooks that would allow me to override the SmartCrawl settings for specific posts?

  • Nithin
    • Support Wizard

    Hi Dan Berdal,

    Sorry for the delay in getting back to you. Just to be sure, by merge tags, you meant the following option?

    If yes, it's meant to work only for posts, if you are testing with page, then I'm afraid, you'll to manually add the keywords in the Edit meta section of your page. Please check the plugin documentation for more info:
    https://premium.wpmudev.org/docs/wpmu-dev-plugins/smartcrawl/#chapter-6

    Tags as Keywords: Let’s say your post has “one”, “two” and “three” tags. If you enable this the Keywords line will be automatically filled with “one, two, three” without you having to manually add them.

    Are there any filters or hooks that would allow me to override the SmartCrawl settings for specific posts?

    Just the SEO Title, and SEO Description, or you also wants to control the keywords too? I'm checking regarding this with our developer to see any hooks that could be implemented regarding this, will keep you posted once I get further update asap.

    Regards,
    Nithin

  • Dan Berdal
    • Design Lord, Child of Thor

    Thanks for the reply - by merge tags I meant that at the network level under "title and meta" you can insert placeholders that will automatically substitute the sites info. I believe inside the plugin they are called "dynamic macros". "merge tag" is maybe a word used more often in email marketing.

    When entered at the network level these tags work correctly for posts, pages, taxonomies, and some homepages network wide with the exception I'm trying to describe...

    At the network level you can set overrides for the Homepage as well as individual post types.

    Under Post Types for example you can set the template for Post/ pages and any other custom post types you use.

    For any given "Page" you can set the title and meta templates at the network level and these work correctly for all sites.

    Under "Homepage" you can set the template for your homepages, and this works correctly if the user uses page of posts style homepage.

    However, if a user selects a static homepage, the homepage uses the "Post Type -> Page" meta templates, instead of using the "Homepage" meta templates.

    The network override still works, it's just using the "page template" instead of the "homepage template" when a static homepage is selected. What would be the point of the "homepage" title and meta templates at the network level if they don't work?

    • Dan Berdal
      • Design Lord, Child of Thor

      Just another follow up here since we have a bit of two conversations going.

      I was also surprised that the "dynamic macros" don't work when entered onto individual pages or posts. Yoast allows using these template tags on individual pages and it makes things easier for site admins.

      You also mentioned that here maybe some functions for controlling the SEO Title and Description. Where would I find out information about what they are and how to use them? I don't care about controlling tags just the title and description is fine.

  • Nithin
    • Support Wizard

    Hi Dan Berdal,

    Hope you are doing good today. :slight_smile:

    The network override still works, it's just using the "page template" instead of the "homepage template" when a static homepage is selected. What would be the point of the "homepage" title and meta templates at the network level if they don't work?

    I do understand your concern regarding this, and I'm bringing this into our developer's attention, to see whether this workflow could be implemented out of the box in the plugin side.

    I was also surprised that the "dynamic macros" don't work when entered onto individual pages or posts. Yoast allows using these template tags on individual pages and it makes things easier for site admins.

    I tested regarding this on an individual page in a subsite with random dynamic macros, and it worked fine:

    If you still have an issue regarding this, please share the page link, and enable support access, so that we could give a closer look at what's being missed.

    You also mentioned that here maybe some functions for controlling the SEO Title and Description. Where would I find out information about what they are and how to use them? I don't care about controlling tags just the title and description is fine.

    There are some filters that could be made use ie wds_custom_og_title, wds_custom_og_description.

    However, I'll have to bring this query into our Second Level Support(SLS) teams attention, so that they could give a working code which you could implement regarding this.

    Please do note that SLS works on complex issues, and have a slow response time. Will keep you posted once I get further feedback regarding the hooks implementation with an example code asap.

    Regards,
    Nithin

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Dan Berdal ,

    Sorry for the late reply. You can use these filters to change the Title & Description of a page manually. You can also target a specific sub-site + page/post as shown in the following example:

    How to install:
    Always make sure to keep a backup of your site before changing/adding custom code.

    1] Navigate to your /wp-content/ directory and create a new one named mu-plugins if it doesn't exist.
    2] Inside the mu-plugins folder create a file named change-og-tags.php
    3] Edit the file and copy / paste this code snippet inside.

    <?php
    
    add_filter(
    	'wds_custom_og_title',
    	function( $title ) {
    		// Change og:title in blog id 2 & page id 4
    		$blogid = get_current_blog_id();
    		global $post;
    		if ( 2 === $blogid && 4 === $post->ID ) {
    			$title = 'A title';
    		}
    
    		return $title;
    	},
    	15
    );
    
    add_filter(
    	'wds_custom_og_description',
    	function( $description ) {
    		// Change og:description in blog id 2 & page id 4
    		$blogid = get_current_blog_id();
    		global $post;
    		if ( 2 === $blogid && 4 === $post->ID ) {
    			$description = 'A description';
    		}
    
    		return $description;
    	},
    	15
    );

    4] Save and close the file.
    5] The final path should look like /wp-content/mu-plugins/change-og-tags.php
    6] Everything should work after that automatically.

    Tell me if you need any further help with this.

    Regards,
    Konstantinos

  • Dan Berdal
    • Design Lord, Child of Thor

    Thanks for your guidance so far on this. Yoast implemented some multisite network level controls so I thought maybe I would stick with that for now. However, Yoast is still doubling or tripling my admin page load times under certain circumstances even with all features turned off.

    So, I'd like to get this figured out.

    The filters you sent me above are for open graph meta, and I also need to update the Title and Description Meta

    I also did just download the most recent update of smart crawl, and the "homepage" template
    /wp-admin/network/admin.php?page=wds_onpage#tab_homepage

    still does not work correctly. It will not override the title and description meta of the taxonomy or page that is set for the homepage.

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hey Dan Berdal ,

    You can similarly use these filters for Title & Description:

    add_filter(
    	'wds_metadesc',
    	function( $desc ) {
    		$desc = 'a description';
    
    		return $desc;
    	}
    );
    
    add_filter(
    	'wds_title',
    	function( $title ) {
    		$title = 'a title';
    
    		return $title;
    	}
    );

    The Homepage setting is working like that on purpose, it is only meant to work with the "Your latest posts" setting. If you set a homepage into a Page then you'll have to specifically edit that pages meta.

    This is something that we make aware to the users on single installations but I see that a notice is missing from multisites with sitewide settings so I will have a talk with our Developer and Designers team on this.

    I do also see the point of overriding "any" page that is set as a Homepage ( as most likely that's what created the confusion here ). I can't promise anything on changes about this for the time being though.

    Regards,
    Konstantinos

  • Dan Berdal
    • Design Lord, Child of Thor

    Thanks for the help

    I do also see the point of overriding "any" page that is set as a Homepage ( as most likely that's what created the confusion here ). I can't promise anything on changes about this for the time being though.

    Glad you see my point! Right now this is the only thing holding me back from ditching Yoast for the 1000+ sites I manage.

    As a network super-admin - it makes sense to be able to control the meta-template for the homepage, and not leave it up to each individual site admin to screw it up :grinning:

    If any developer needs a reason to allow network level override of all homepage meta, I can show them 1000 people who will make a mess of their seo if given the opportunity.

    Maybe in the meantime we can solve this with filters, although a UI option would be better for the long term (and would benefit other users)

    Here's what you've told me, and some that I found or deduced:
    Meta Title: wds_title
    Meta Desciption: wds_metadesc
    og:title - wds_custom_og_title
    og:description - wds_custom_og_description
    og:url - wds_custom_og_url
    og:image - wds_custom_og_image
    canonical url - wds_filter_canonical

    I can't find
    twitter:title
    twitter:description

    any ideas what the filters might be for twitter

      • Dan Berdal
        • Design Lord, Child of Thor

        Twitter meta will change with wds_title & wds_metadesc as well.

        This might be true if those values are set via the UI, but when changed by the filters, it's not working.

        Here is a sample page on my dev site: https://new.essentialoilylife.com/usa-template/

        We have:
        <title>USA Template title test's|test site</title>

        and
        <meta property="og:title" content="USA Template title test's|test site">

        but

        <meta name="twitter:title" content="How to use these graphics | USA Template title test's">

        The twitter title and description are not following wds_title & wds_metadesc as you're describing

        Here is the code I'm currently using:

        add_filter('wds_custom_og_title','custom_meta_title',15);
        add_filter('wds_title','custom_meta_title');
        add_filter('wds_custom_og_description','custom_meta_description', 15);
        add_filter('wds_metadesc','custom_meta_description');
        add_filter('wds_filter_canonical','custom_meta_url');
        add_filter('wds_custom_og_url','custom_meta_url');
        /* add_filter('wds_custom_og_image','custom_meta_url'); */
        function custom_meta_title($title){
        	 if(is_home()){
        			$blog_title = get_bloginfo( 'name' );
        			$blog_description = get_bloginfo( 'description' );
        			$title = $blog_title . "|" . $blog_description;
        			/* $title = "here is my custom title"; */
        		}
        	return $title;
        }
        function custom_meta_description ($description){
        	if(is_home()){
        			$description = get_bloginfo( 'description' );
        		}
        		return $description;
        }
        function custom_meta_url($url){
        	if(is_home()){
        		$siteurl = get_mapped_site_url();
        	}
        	return $siteurl;
        }
  • Konstantinos Xenos
    • Rubber Duck Debugger

    Dan Berdal ,

    Could you move the $description outside of the is_home() check and test it that way? I didn't had any problem with the above code at all in my installations ( using the latest SmartCrawl version ). The only thing I disabled is the is_home() checks since I have a different setup.

    Basically what I've changed from your code was this, commented out the home checks:

    function custom_meta_description ($description){
    	//if (is_home()){
    			$description = get_bloginfo( 'description' );
    		//}
    		return $description;
    }

    And it works fine all around my tests single & multisite.

    Regards,
    Konstantinos

  • Dan Berdal
    • Design Lord, Child of Thor

    Hi Konstantinos,

    With the 2.3 update the Twitter meta now works for me. Sorry, I thought I was running the latest version, but it looks like I had missed that update a few days ago . I checked the changelog and was hopeful they had changed the network behavior for the home page meta, but it looks like it still working the same way it has been.

    For future reference, and anyone else who stumbles across this thread. The code that I posted for overriding meta, works correctly as of smart crawl version 2.3

    So... my problem is solved now that the filters are all working, but I still think the a network level override for all homepage meta is a better solution.

    Thanks for helping with this!

    • Konstantinos Xenos
      • Rubber Duck Debugger

      Ah the update was the case then, yes the discussion here & with our developers about having more globalized overrides for networks happened after 2.3 was out ( the release was 8 days ago ).

      I'm glad we could make it work even with the filters for the time being though!

      Regards,
      Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.