Questions tagged as ['path-aliases']

In Drupal 8, my custom module includes the code
if (\Drupal::service('path.alias_storage')->aliasExists($path, 'en')) {
return true;
}
What should this look like in Drupal 9.2? Seems so simple, but I can't figure it out after reading every post I can find.
I am working on a Drupal website. I need to automatically generate 2 url aliases for the same node on the website. I have tried installing Pathauto but it lets me generate only 1 alias when a new page is created. Is it possible to have it automatically create 2 aliases when the page is created?
Do we do this via the module itself or can we have this done by code?
Thanks

On this page admin/config/search/path
, we can only filter the results by URL alias.
I want to filter the results by node id as well?
How can I do that?
It is not possible with form alter. As the original form submit is redirecting to the entity.path_alias.collection
route with the url alias filter only.
Is there any way, I can filter them by node id?
I'm setting up a multilingual site, and I need the user path aliases to be multilingual.
Users are set up as translatable:
Language Detection: URL (path prefix)
- English:
/en
- Japanese: No prefix
Pathauto patterns:
- English:
/en/users/[user:name]
- Japanese: '
/users/[user:name]
Example:
- Username: Admin
Expected paths:
- English:
/en/users/admin
- Japanese:
/users/admin
Actual:
- English:
/en/user/1
I have a content type Products. A pattern is defined via the Pathauto module for product CT. but my issue is that when I translate an entry/node it generates a translated path alias for Urdu in Roman-English(Urdu in English alphabet) But the spellings of that path are meaningless. When I uncheck "Transliterate prior to creating alias" It generates the aliases in pure Urdu which is unacceptable in my ...

My site was built using Lightning Drupal distribution.
I had my public path as /sites/default/files. I did change the configuration path to /sites/<my_domain>/files in the middle of the project. From then, when I upload an image to a node it's taking the destination as /sites/<my_domain>/files as expected.
Problem:
I've created a view block to display the node titles and images on the home pa ...
How do I programmatically create a path alias in Drupal 9?
I'm creating node, but I also want to give the node a URL alias, but cannot figure out what class to use, PathAlias or AliasManager or ...?
We have an annual reporting sites that contains approximately 200 nodes each year. When the next year's reports are complete, all of the current year's nodes move to a path like /archives/fy2020/*
. Not only do their paths change, but the menu items change as well to 1) create a new entry year 2) move menu items to the new entry year as the parent.
I am looking at what type of batch process I can used to ...
There is vocabulary, let's call it forum tags which contain all forum tags, Also, in Forum, the link for the Forum container using a similar tag pattern for the forums. for example,
Term name : windows
term alias: /forum/windows
Forum container: windows
forum alias: /forum/windows
if I open /forum/windows
always term page will be loaded which means it has a higher priority.
at the moment all requ ...
I have a large website with 240 urls that need to be updated. I would like to do this programmatically to avoid making errors. I created the following function which seems to work. There seems to be a good bit of complexity here for what I am trying to accomplish. Is there a simplier way to update the url of a node?
function alias_replace($path, $lang, $new_alias) {
$path_alias_manager = \Dr ...

We have two websites running off a single domain:
https://www.mywebsite.com/mywebsitetools
Both websites have their own databases and are hosted by Acquia.
We've been using Drush 8.x and the sql-sync command for the past number of years to synchronizing the database between the local environment and Acquia.
Last week we upgraded to using Drush 10.3.6 and now we're running i ...
How can I set automatic URL aliases for taxonomy feeds?
Say I have a term with tid=1
, named holidays
, with a system URL of /taxonomy/term/1
that is accessible by the URL alias /holidays
. Then I want the rss feed for that term to be accessible on the URL alias /holidays/feed
or /holidays/rss.xml
. That sounded rather easy when I first thought about it, but it seems that pathauto is not supporting that (o ...
I have taxonomy named Category with two terms: News and Articles.
Articles term has custom url alias - /useful
.
The website was upgaded from D7 to D9. On old D7 version node url pattern was [node:field_categories]/[node:title]
On D9 it is the same pattern, BUT instead of /useful/node-title
it dispalays /articles/node-title
Maybe it is not a big deal, but after porting to D9 I would like to maintain curr ...
My client has content tagged by a hierarchical taxonomy of arbitrary depth.
Currently the maximum depth is three, but that could change:
ParentTerm
└── ChildTerm
└── GrandchildTerm
Each Term has a unique TID (of course), but many Terms (especially descendants) share identical strings for Name.
However, the full Taxonomy tree path to each term is guaranteed to be unique (two adjacen ...
I do not understand the hook. I would expect, that "pattern_alter" would allow me to "alter" the "pattern". But this seems to be not the case.
I tried also to alter the alias... which also does not seem to have an effect.
Could somebody show me a working example please?
function xxx_pathauto_pattern_alter(\Drupal\pathauto\PathautoPatternInterface &$pattern, array $context) {
/* /////////////////// ...

I have a SQL query to get all nodes with their ID, title, publish date, change date, etc.
Additionally I need to get path to each of them (probably from path_alias.alias).
Now I have following (without alias):
SELECT MIN(node_field_data.nid) AS nid,node_field_data.type, node_field_data.status, node_field_data.title, node_field_data.langcode AS node_field_data_langcode, node_field_data.created, node_field ...

First, I would like to say I am a total noob in Drupal and PHP but possess some knowledge on other web frameworks/languages).
Here is my path to the errors:
I used the UI to install Content Translation and Configuration Translation modules from the multilingual core (other 2 modules were already installed).
This did not work properly as it totally broke the website:
- aliases not respected (from "/co ...