ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 12 - AD0-E722 discussion

Report
Export

An Adobe Commerce Architect needs to scope a bespoke news section for a merchants Adobe Commerce storefront. The merchant's SEO agency requests that the following URL structure:

news/{date}/{article_url_key}, where {date} is the publication date of the article, and {article_url_key} is the URL key of the article.

The Architect scopes that a news entity type will be created. The date and URL key data will be stored against each record and autogenerated on save. The values will be able to be manually overridden.

A.
The Architect needs to manage routing this functionality and adhere to best practice. Which two options should the Architect consider to meet these requirements? (Choose two.)
Answers
A.
The Architect needs to manage routing this functionality and adhere to best practice. Which two options should the Architect consider to meet these requirements? (Choose two.)
B.
Create a standard controller route and mapping the internal URLs (such as news/article/view/id/i) to rewrites that are generated on save and then stored in the URL rewrites table.
Answers
B.
Create a standard controller route and mapping the internal URLs (such as news/article/view/id/i) to rewrites that are generated on save and then stored in the URL rewrites table.
C.
Create a custom router that runs before the standard router and matches the news portion of the URL, then looks for and loads a news article by matching the date and URL key parts of the URL
Answers
C.
Create a custom router that runs before the standard router and matches the news portion of the URL, then looks for and loads a news article by matching the date and URL key parts of the URL
D.
Create a plugin that intercepts Magento\Framework\App\Action: :(), looks for the news portion of the URL, and if it matches, loads the relevant news article by matching the URL date and URL key parts.
Answers
D.
Create a plugin that intercepts Magento\Framework\App\Action: :(), looks for the news portion of the URL, and if it matches, loads the relevant news article by matching the URL date and URL key parts.
E.
Create a standard controller route and an index/index controller class that loads the relevant news article by matching the URL date and URL key parts.
Answers
E.
Create a standard controller route and an index/index controller class that loads the relevant news article by matching the URL date and URL key parts.
Suggested answer: B, C

Explanation:

These two options are both valid ways to manage routing for the bespoke news section and adhere to best practice. Option B leverages the existing URL rewrite functionality of Adobe Commerce, which allows creating custom URLs for any entity type and storing them in the database. This option requires creating a standard controller route for the news entity type, such as news/article/view/id/i, where i is the news article ID. Then, on saving each news article, a rewrite rule is generated that maps the internal URL to the desired SEO-friendly URL, such as news/{date}/{article_url_key}. The rewrite rule is stored in the url_rewrite table, which is used by the standard router to match and redirect requests.

Option C involves creating a custom router class that implements \Magento\Framework\App\RouterInterface and runs before the standard router in the routing process. The custom router class can match the news portion of the URL and extract the date and URL key parts from it. Then, it can look for and load a news article that matches those values using a model or repository class. If a match is found, it can set the request parameters accordingly and dispatch the request to a controller action that renders the news article page.

Routing | Adobe Commerce Developer Guide

URL Rewrites | Adobe Commerce Developer Guide

Custom Router | Adobe Commerce Developer Guide

asked 02/10/2024
Theodoros Flabouras
42 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first