seo – How can get Google to index a URL with a canonical tag?

We have the URL routes with the schema: /ads/:city.
The objective is to get URLs that use this route indexed in Google:

  • /ads/joinville
  • /ads/lages
  • /ads/florianopolis

Today, Google Search Console reports all the pages are canonical of /ads/lages even though each page has its own unique canonical tag. For example, the canonical tag for /ads/florianopolis is: <link rel="canonical" href="https://example.com/ads/florianopolis" />

How we can get Google to index all these URLs?

Graph API url to target a specific file in a specific site

Let’s say I have a file located in https://mycorp.sharepoint.com/sites/somesite/Shared documents/General/MyFolder/myfile.xlsx.

How to reach this file using a graph request ?

I tried : https://graph.microsoft.com/v1.0/sites/mycorp.sharepoint.com:/sites/somesite:/drive/root:/General/MyFolder/myfile.xlsx.

But it fails with "code": "BadRequest","message": "Url specified is invalid." error.

The furthest I can reach without error is the library itself : https://graph.microsoft.com/v1.0/sites/mycorp.sharepoint.com:/sites/somesite:/drive.

How to fix my request?

EDIT: If I use the ID of the site instead of the relative path : https://graph.microsoft.com/v1.0/sites/mycorp.sharepoint.com,aaf8a27d-dcc4-44e7-a9c9-a9124a4bb7f7,bb706eb0-ebd1-42f7-ee5a-97230eaf447c/drive/root:/General/MyFolder/myfile.xlsx

it works as expected. But I my context (no code platform), I may be painful to retrieve the site IDs then get the file in a second request

Custom post type rewrite url structure with taxonomy and sub taxonomy

I’m building a cars post type, so I have ( brands/models ) as a custom taxonomy ( it’s only one taxonomy ) and all created by the CPT UI plugin.

Now I need the URL for the custom post type to be the following sitename/cars/parent-taxonomy/child-taxonomy/postname

so in real life example will be sitename/cars/opel/astra/xxxxx now I have rewrite the URL to be like this /cars/%brand_and_model% and I added the following code in functions.php

function wpa_show_permalinks( $post_link, $post ){
    if ( is_object( $post ) && $post->post_type == 'cars' ){
        $terms = wp_get_object_terms( $post->ID, 'brands_and_models' );
        if( $terms ){
            
            
            return str_replace( '%brands_and_models%' ,$terms(0)->slug , $post_link );
        }
    }
    return $post_link;
}
add_filter( 'post_type_link', 'wpa_show_permalinks', 1, 2 );

but it’s not what I want it’s using only the primary term in the post type and not in the parent/child structure that I need to be.

reverse proxy – NGINX How to try a url and return another source if failed

I am currently running an NGINX reverse proxy to another machine in a local network, if the endpoint of the proxy fails to respond (like timeout) I want to return a custom error page.html file that contains custom content

server{
    listen 80;
    server_name url.co;
    location / {
        proxy_pass 192.168.2.15;

        #here i want to catch if there is a timeout/no response and return an html file
    }
}

@wordpress/create-block image url in css

how to include image URL to css “style.css” in custom block?

Both these not work:
background-image: url(“images/imagename.png”);
background-image: url(“./images/imagename.png”);

Image was compiled with hash like imagename.asdasdasd.png but the path on frontend is bad (not aiming to plugin).

Gutenberg editor link (in administration – working):

http://webname.test/app/plugins/wwb-key-properties/build/images/line.d71a3edf.png

Frontend link (not working):

images/line.d71a3edf.png

Thanks for help

How to insert multiple URLs with a title for each URL in an SharePoint List Column?

I am trying to know if there is a way to insert multiple URLs and give a title to each URL in a column. For reference, please have a look at this below image.

enter image description here

In this list, we have Title, Name and ArtifactLink. The Name column has duplicate values, so may I know If there is a way like Name -> Agile, ArtifactLink -> Planning Poker Guidance with it’s URL and Project Startup with it’s URL.

plugins – How to create blob url for video hosted on Vimeo

I’ve seen some sites that embed video from Vimeo using a blob url.

I’d like to do the same but I’m not understanding how I can do it.

  1. I tried to search for a plug-in, but without success: searching for “blob” in the plug-ins directory, the results relate to “block” and are not pertinent
  2. I understood that I need to generate the blob url on the front end using javascript, but, is this the right way?

My goal is to embed a Vimeo video in a private page, but using blob format to make the download a bit harder.

Any ideas?

magento2.3 – Magento 2.3.5-p1 How to add a prefix to the product url?

I am working on Magento 2.3.5-p1 and I need to add a prefix in the product urls just before the product name.

I have tried with this example but there is a deprecated function so it fails. So I have copied the original files from my Magento 2.3.5-p1 and modified some parts according to the example, but it still doesn’t work. I leave my code below in case someone can help me.

Vendor/Module/Model/Url.php

<?php
declare(strict_types=1);

namespace VendorModuleModel;

use MagentoUrlRewriteModelUrlFinderInterface;
use MagentoUrlRewriteServiceV1DataUrlRewrite;
use MagentoFrameworkAppConfigScopeConfigInterface;

class Url extends MagentoCatalogModelProductUrl
{
    /**
     * URL instance
     *
     * @var MagentoFrameworkUrlFactory
     */
    protected $urlFactory;

    /**
     * @var MagentoFrameworkFilterFilterManager
     */
    protected $filter;

    /**
     * Store manager
     *
     * @var MagentoStoreModelStoreManagerInterface
     */
    protected $storeManager;

    /**
     * @var MagentoFrameworkSessionSidResolverInterface
     */
    protected $sidResolver;

    /** @var UrlFinderInterface */
    protected $urlFinder;

    /**
     * @var MagentoFrameworkAppConfigScopeConfigInterface
     */
    private $scopeConfig;

    /**
     * @param MagentoFrameworkUrlFactory $urlFactory
     * @param MagentoStoreModelStoreManagerInterface $storeManager
     * @param MagentoFrameworkFilterFilterManager $filter
     * @param MagentoFrameworkSessionSidResolverInterface $sidResolver
     * @param UrlFinderInterface $urlFinder
     * @param array $data
     * @param ScopeConfigInterface|null $scopeConfig
     */
    public function __construct(
        MagentoFrameworkUrlFactory $urlFactory,
        MagentoStoreModelStoreManagerInterface $storeManager,
        MagentoFrameworkFilterFilterManager $filter,
        MagentoFrameworkSessionSidResolverInterface $sidResolver,
        UrlFinderInterface $urlFinder,
        array $data = (),
        ScopeConfigInterface $scopeConfig = null
    ) {
        parent::__construct($urlFactory, $storeManager, $filter, $sidResolver, $urlFinder, $data);
        $this->urlFactory = $urlFactory;
        $this->storeManager = $storeManager;
        $this->filter = $filter;
        $this->sidResolver = $sidResolver;
        $this->urlFinder = $urlFinder;
        $this->scopeConfig = $scopeConfig ?:
            MagentoFrameworkAppObjectManager::getInstance()->get(ScopeConfigInterface::class);
    }

    /**
     * Retrieve URL in current store
     *
     * @param MagentoCatalogModelProduct $product
     * @param array $params the URL route params
     * @return string
     */
    public function getUrlInStore(MagentoCatalogModelProduct $product, $params = ())
    {
        $params('_scope_to_url') = true;
        return $this->getUrl($product, $params);
    }

    /**
     * Retrieve Product URL
     *
     * @param  MagentoCatalogModelProduct $product
     * @param  bool $useSid forced SID mode
     * @return string
     */
    public function getProductUrl($product, $useSid = null)
    {
        $params = ();
        if (!$useSid) {
            $params('_nosid') = true;
        }
        return $this->getUrl($product, $params);
    }

    /**
     * Format Key for URL
     *
     * @param string $str
     * @return string
     */
    public function formatUrlKey($str)
    {
        return $this->filter->translitUrl($str);
    }

    /**
     * Retrieve Product URL using UrlDataObject
     *
     * @param MagentoCatalogModelProduct $product
     * @param array $params
     * @return string
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     */
    public function getUrl(MagentoCatalogModelProduct $product, $params = ())
    {
        $routePath = '';
        $routeParams = $params;

        $storeId = $product->getStoreId();

        $categoryId = null;

        if (!isset($params('_ignore_category')) && $product->getCategoryId() && !$product->getDoNotUseCategoryId()) {
            $categoryId = $product->getCategoryId();
        }

        if ($product->hasUrlDataObject()) {
            $requestPath = $product->getUrlDataObject()->getUrlRewrite();
            $routeParams('_scope') = $product->getUrlDataObject()->getStoreId();
        } else {
            $requestPath = $product->getRequestPath();
            if (empty($requestPath) && $requestPath !== false) {
                $filterData = (
                    UrlRewrite::ENTITY_ID => $product->getId(),
                    UrlRewrite::ENTITY_TYPE => MagentoCatalogUrlRewriteModelProductUrlRewriteGenerator::ENTITY_TYPE,
                    UrlRewrite::STORE_ID => $storeId,
                );
                $useCategories = $this->scopeConfig->getValue(
                    MagentoCatalogHelperProduct::XML_PATH_PRODUCT_URL_USE_CATEGORY,
                    MagentoStoreModelScopeInterface::SCOPE_STORE
                );

                $filterData(UrlRewrite::METADATA)('category_id')
                    = $categoryId && $useCategories ? $categoryId : '';

                $rewrite = $this->urlFinder->findOneByData($filterData);

                if ($rewrite) {
                    $requestPath = $rewrite->getRequestPath();
                    $product->setRequestPath($requestPath);
                } else {
                    $product->setRequestPath(false);
                }
            }
        }

        if (isset($routeParams('_scope'))) {
            $storeId = $this->storeManager->getStore($routeParams('_scope'))->getId();
        }

        if ($storeId != $this->storeManager->getStore()->getId()) {
            $routeParams('_scope_to_url') = true;
        }

        if (!empty($requestPath)) {
            $routeParams('_direct') = $requestPath;
        } else {
            $routePath = 'catalog/product/view';
            $routeParams('id') = $product->getId();
            $routeParams('s') = $product->getUrlKey();
            if ($categoryId) {
                $routeParams('category') = $categoryId;
            }
        }

        // reset cached URL instance GET query params
        if (!isset($routeParams('_query'))) {
            $routeParams('_query') = ();
        }

        /*$url = $this->urlFactory->create()->setScope($storeId);
        return $url->getUrl($routePath, $routeParams);*/




        $baseUrl = $this->storeManager->getStore()->getBaseUrl();
        $productUrl = $this->getUrlInstance()->setScope($storeId)->getUrl($routePath, $routeParams);

        $remainingUrl = str_replace($baseUrl, '', $productUrl);

        $productUrl = $baseUrl."product/" . $remainingUrl;
        //return $this->getUrlInstance()->setScope($storeId)->getUrl($routePath, $routeParams);
        return $productUrl;
    }
}

Vendor/Module/Controller/Router.php

<?php
namespace VendorModuleController;
use MagentoUrlRewriteModelUrlFinderInterface;
use MagentoUrlRewriteServiceV1DataUrlRewrite;
class Router implements MagentoFrameworkAppRouterInterface
{
    protected $actionFactory;
    protected $storeManager;
    protected $urlFinder;
    public function __construct(
        MagentoFrameworkAppActionFactory $actionFactory,
        MagentoStoreModelStoreManagerInterface $storeManager,
        UrlFinderInterface $urlFinder
    ) {
        $this->actionFactory = $actionFactory;
        $this->storeManager = $storeManager;
        $this->urlFinder = $urlFinder;
    }
    public function match(MagentoFrameworkAppRequestInterface $request)
    {
        $replaceUrl = str_replace("product/", "", $request->getPathInfo());
        $rewrite = $this->getRewrite($replaceUrl, $this->storeManager->getStore()->getId());
        if ($rewrite == null)
        {
            return null;
        }
        $request->setAlias(MagentoFrameworkUrlInterface::REWRITE_REQUEST_PATH_ALIAS, $rewrite->getRequestPath());
        $request->setPathInfo("https://magento.stackexchange.com/" . $rewrite->getTargetPath());
        return $this->actionFactory->create('MagentoFrameworkAppActionForward');
    }
    protected function getRewrite($requestPath, $storeId)
    {
        return $this->urlFinder->findOneByData((
            UrlRewrite::REQUEST_PATH => trim($requestPath, "https://magento.stackexchange.com/"),
            UrlRewrite::STORE_ID => $storeId,
        ));
    }
}

Thanks in advance.

Adding a suffix/unique URL for bundled products

I currently have bundled products that are broken down by size. For example,

Grey T Shirt (Bundle)

  • Small T Shirt
  • Medium T Shirt
  • Large T Shirt

Currently the url is example.com/greytshirt

Is there a way to add an suffix to the end of the URL so I can directly link to a certain size? E.G – example.com/greytshirt?large

Thans

magento2 – Magento 2 Check if error then redirect to custom url

I am using create post plugin. But the issue with this is, I want to redirect it to a custom URL if an error occurred in createPost() default to execute the function.

For example, if a customer with the same email id already exists then it goes in the catch of default createPost() execute function’s catch. I want to redirect it to my custom page.

Please note, No code to add in try. So try-catch is not used.

Also tried with throw exception but I don’t know how to direct with throw exception or with throw it is possible or not.

Thanks in advance.