• Resolved gerd.neumann

    (@gerdneumann)


    Hey,

    seems like varnish-http-purge does not support Polylang. At least the to-be-purged URLs are not the ones that Polylang generates (it uses prefixes for languages like /en/feed/ instead of /feed/; or /de/comments/feed instead of /comments/feed, same for the author’s URL).

    It works for the actual URL. That is, if I edit /de/mypage/ then /de/mypage/ will be correct in the to-be-purged URLs. But all “related” URLs are not included (link to author’s list, RSS, RDF feeds and so on — these all miss the /de/ or /en/ language prefix).

    I am not sure how the list of to-be-purged URLs is generated.

    Probably some code as described at https://polylang.pro/doc/function-reference/ would need to be used instead.

Viewing 1 replies (of 1 total)
  • Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Situations like this is why I added a bunch of filters: https://github.com/Ipstenu/varnish-http-purge/wiki/Custom-Filters

    You’ll want something like this:

    function my_polylang_varnish_urls( $urls, $postid ) {
    	$myurl = 'http://example.com/newest/';
    	array_push( $urls, $myurl ) ;
    return $urls;
    }
    add_filter( 'vhp_purge_urls', 'my_polylang_varnish_urls' );

    And instead of $myurl = 'http://example.com/newest/'; you’ll have to use their pll_languages_list( $args ); to get a list of the languages and then … I think this?

    
    $languages = pll_languages_list();
    $post = get_post($postid); 
    $slug = $post->post_name;
    $myurls = array ();
    
    foreach ($languages as $language) {
        $myurls[] = ???
    }
    

    Where I put in ?? you’ll have to rebuild the URLs for each language. That said, I’m not sure how, since I didn’t see a quick way to ‘get all the related URLs’

    This is not something I would add to the plugin, though. It’s something you’d want to build (or hire someone to build) as a custom add-on :/

Viewing 1 replies (of 1 total)
  • The topic ‘Compatibility with Polylang wrt to ‘related’ URLs (feed, authors list, etc)?’ is closed to new replies.