Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEO friendly urls #2010

Closed
ngeleedst opened this issue Nov 21, 2018 · 19 comments
Closed

SEO friendly urls #2010

ngeleedst opened this issue Nov 21, 2018 · 19 comments
Assignees
Labels
feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can
Milestone

Comments

@ngeleedst
Copy link

What is the motivation for adding / enhancing this feature?

The urls that are being generated in the Vue Storefront are not SEO best practices, we would like to use product slugs without sku. Next to this issue it would be nice to have some kind of url rewrite possibility because now you have to allocate every module to a route like:

Category: /category-slug
Pages: /page/page-slug
Product: /product/123/product-url/123

I think we need to develop a general entry point for all types and from that point match if the slug is for a category, page or product.

What are the acceptance criteria

  • Product urls from /123/product-slug/123 to /product-slug
  • Advanced routing module for url rewrites

Can you complete this feature request by yourself?

No.

Additional information

None

@afirlejczyk
Copy link
Contributor

afirlejczyk commented Nov 21, 2018

  • We should be able to use 'url_path' attribute from Magento as url for Product and Categories
    We have to remember about urls with extra slashes, e.g women/tops.html - this url also should work for category.

  • there should be new option in config for this new feature

@jahvi
Copy link
Contributor

jahvi commented Nov 23, 2018

Is it worth leveraging/porting the urlResolver GraphQL query introduced in 2.3? from the docs:

The urlResolver query returns the canonical URL for a specified product, category or CMS page

The query returns the type of entity (PRODUCT, CATEGORY, or CMS_PAGE) so the right component can be used depending on this.

Example Query

{
  urlResolver(url: "venia-tops.html") {
    id
    canonical_url
    type
  }
}

Result

{
  "data": {
    "urlResolver": {
      "id": 7,
      "canonical_url": "catalog/category/view/id/7",
      "type": "CATEGORY"
    }
  }
}

@pkarw
Copy link
Collaborator

pkarw commented Nov 23, 2018

@jahvi I’m not sure about it. The most challenging part of this feature to keep the offline cache working. As well resign from having the sku in url we must ensure that we store the cached products under url_key based keys in indexed db (please take a look at core/modules/catalog/store/product/actions.ts avtion single and how it’s caching the product)

@pkarw
Copy link
Collaborator

pkarw commented Nov 23, 2018

@madonzy we can probably store the sku/url_key mapping in kind of localStorage - populated in the product/list method

Please take a look at #2021 - where I've described exactly how offline cache works

@jahvi
Copy link
Contributor

jahvi commented Nov 23, 2018

@pkarw I see this sounds more complicated than I thought then, perhaps it might be too hard to implement with the current indexedDB approach.

@pkarw
Copy link
Collaborator

pkarw commented Nov 23, 2018

@jahvi I think we need to start with a modest solution based on product.url_key and category.url_key - making it just more flexible / removing SKU dependency in URLs and keeping offline-cache in place. If we succeeded in that - then we can think of url_rewrites as a next step. How does it sound?

@pkarw pkarw added the feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can label Nov 23, 2018
@jahvi
Copy link
Contributor

jahvi commented Nov 24, 2018

I see, so you mean for example instead of having product keys in indexedDB as sku$$MP01 change it to something like url$$josie-yoga-jacket and select based on that?

@pkarw
Copy link
Collaborator

pkarw commented Nov 24, 2018

Correct. Either to map sku to url keys for lookup

@ngeleedst
Copy link
Author

Any updates on this request?

@Cyclonecode
Copy link
Collaborator

I am also wondering about this and if there are any updates on this issue?

@jonathanselander
Copy link

What about the current inconsistency between vsf and the underlying platform managing URLs, redirects, and what admins assume?

@jahvi
Copy link
Contributor

jahvi commented Dec 16, 2018

Sorry I haven't been able to start work on this one as I've been working on other parts of VS. Feel free to submit a PR if anyone wants to give it a go 😃

@pkarw pkarw added this to the 2.0 milestone Feb 2, 2019
@pkarw pkarw self-assigned this Feb 8, 2019
@pkarw
Copy link
Collaborator

pkarw commented Feb 8, 2019

Any feedback will be much appreciated: #2401

pkarw added a commit to vuestorefront/mage2vuestorefront that referenced this issue Feb 12, 2019
@pkarw pkarw modified the milestones: 1.10, 1.9-rc Mar 1, 2019
@pkarw pkarw closed this as completed Mar 1, 2019
@ResuBaka
Copy link
Collaborator

I have test this with an magento 1 store and the urls in category are /sku/url_key/ and in search they are /url_path?sku and when i try to go to a product like example http://localhost:3000/Aufschnittmaschine-ASM-300?childSku i get the error "The product, category or CMS page is not available in Offline mode. Redirecting to Home.".

Is there anything i am missing? I am an the latest develop and have useUrlDispatcher and useShortCatalogUrls set to true.

@pkarw
Copy link
Collaborator

pkarw commented Mar 19, 2019

I belive You should have useShortCatalogUrls set to false

@ResuBaka
Copy link
Collaborator

ResuBaka commented Mar 19, 2019

When I disable useShortCatalogUrls then the product url does work. But I want to have both at the same time. Or is it not intended to work together?

@pkarw
Copy link
Collaborator

pkarw commented Mar 19, 2019

It's not. Please set the product.url_path or category.url_path to whatever value you need and it will be Your url :) as simple as that :) so it's much more powerfull than useShort...

@DaanKou
Copy link

DaanKou commented May 7, 2019

@pkarw what do exactly mean with setting the ‘product.url_path’ and ‘category.url_path’ to any value? As these properties are now already filled by Mage2VueStorefront?

@pkarw
Copy link
Collaborator

pkarw commented May 8, 2019

Yes, these fields are set by mage2vuestorefornt and magento2-vsbridge-indexer and are used to map the urls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can
Projects
None yet
Development

No branches or pull requests

8 participants