Questions tagged [path-aliases]
Use it for questions about path aliases, a way of creating pretty human readable URLs to replace system URLs like node/[nid].
842
questions
88
votes
11
answers
190k
views
How do I get the current path alias or path?
How can I get the current alias and/or path in Drupal 8?
In Drupal 7 I did this with drupal_get_path_alias(). What is the equivalent code I should use in Drupal 8?
43
votes
9
answers
90k
views
How can I get the path alias from a node ID or node object?
I have a node object, and I am trying to use it to get a given path in Drupal 8.
There was drupal_lookup_path() in Drupal 7 but I'm not seeing any equivalent or documentation for Drupal 8.
What's ...
25
votes
4
answers
25k
views
How can I get the node ID from a path alias?
I want to be able to get the nid but the only information I have is http://example.com/this-is-the-alias.
Is there a way to get either the internal path of /node/* for that alias if I am not on the ...
20
votes
4
answers
13k
views
Clean urls - auto path alias - how to remove accents (Á É Ó Í Ñ ) from the urls?
I´m using Drupal 7.9 and pathauto 7.x-1.0-rc2
I want to remove the accents from the paths and replace them with normal letters
Á=A
É=E
Ó=O
Í=I
Ñ=N
etc.
I'm using a taxonomy field type and node ...
14
votes
8
answers
27k
views
Is it possible to programmatically add a path alias to a programmatically created node?
I implemented a pre-save hook in a module, which populates nodes by fetching information from various APIs. I can't get my mind around how to add a path alias to newly created nodes.
Is there a ...
14
votes
5
answers
9k
views
how to separate taxonomy hierarchy in pathauto with slashes
Pathauto seems to have a different way of aliasing taxonomy hierarchy.
From Taxonomy Menu:
Classifieds > Cars > Aston Martin > DB9 Coupe
Classifieds > Jobs > Accounting
What I want is something ...
14
votes
3
answers
3k
views
Disable pathauto for nodes created with migrate module
I'm using migrate to import a bunch of nodes and I want to set the path alias during the migration. I am able to import the path alias just fine like so:
$this->addFieldMapping('path', 'url_alias')...
14
votes
6
answers
13k
views
How do I use URL aliases in menus?
I am kicking the tires on Drupal 7 by spinning up a test site.
I chose the Danland theme and created various pages with URL Aliases for each, but when I create the Menu link for each, I can only ...
11
votes
8
answers
15k
views
Path alias creates redirect loop or redirects to the front page
When I call our sit "www.example.com/contact-us" I'm getting the following error:
Oops, looks like this request tried to create an infinite loop. We do not allow such things here. We are a ...
11
votes
2
answers
8k
views
How to set URL alias automatically for a content type WITHOUT using Pathauto? Which hook to implement?
Pathauto can do the job easily for all content types, but in my case I only have one content type URL that needs to be customized, and I would prefer to not install Pathauto and Token.
Can anyone ...
10
votes
8
answers
17k
views
How to get the path to the translated node?
I've set up a multilanguage site in Drupal 7. In a template I need to add a link to a specific content node. This node has translations and path aliases like so:
node/42 = pathalias_de (german ...
10
votes
4
answers
29k
views
Create path alias programatically when node is created
I have a custom content type that is created by a module. Is there a hook I can use to set the path alias of my custom content type when a node is created?
One of my fields is an alpha-numeric code, ...
9
votes
2
answers
915
views
Is PathAuto module a memory hog?
I'm probably going to need to use the PathAuto module for a current project. While using it in development, as admin, the site slowdown during changes is insane.
Is PathAuto a big memory sink, and ...
9
votes
1
answer
8k
views
Which mysql tables contain the URL Alias path data?
Im looking to manually change a node's URL path as my edit button throws me an error upon clicking it since this was due to orphaned data left over from some other uninstalled modules. Which tables ...
8
votes
5
answers
8k
views
How do I translate view's page path alias?
I'm able to translate views titles and menus thanks to config_translation core module. I would like to have path aliases translated as well but it seems to lack this feature. Any other way to do it?
8
votes
3
answers
5k
views
How do you change the URL alias of a contact form?
Sounds simple enough, right? I can't find it anywhere. My contact form's path remains:
/contact/contact_us
And I have no idea where to change this. I have checked under the form settings at:
/...
8
votes
3
answers
3k
views
A large amount of Tokens slows down everything - Placeholder Tokens
had anyone of you had a problem with too large amount of tokens? Because of having few content types (~8) with bunch of fields (~5-10 each) Token module generates too big table with replacement tokens....
8
votes
1
answer
4k
views
How do I define a Route with multiple different paths?
Does Drupal's routing system support a regular expression or other means for multiple route paths? I have a route that I would like to be able to hit from two different endpoints, /api/v1/foo and /api/...
8
votes
2
answers
737
views
Managing custom aliases on translated content
We have a Drupal 8 site with translated content, and using the Pathauto module. The issue we are running into is that when we un-check the "Generate automatic URL alias" on, say, the Chinese node, ...
7
votes
4
answers
16k
views
Get node alias in template
I create a about-us with Basic Page content type, and with path alias aliased it to \about-us( nid = 2),Now in template file I want to get path alias
<li><a href="{{ ??????? }}">{{ '...
7
votes
3
answers
4k
views
Disable node summary page on /node path
I want to disable the default front page, that is showing a list of nodes. I use another front page but it is still displayed at the url example.com/node. Either restricting access or redirecting to ...
7
votes
2
answers
1k
views
URL-Alias for language neutral content
I have a page with 8 languages. Most of the content is translated and have a language assigned. But there is one part of the page, where I need language neutral content to show in each language.
If ...
6
votes
2
answers
9k
views
Change templates based on path alias
What is the easiest way to select a template based on path alias. For example, if I have the following URLs:
http://www.example.com/mydirectory/page1
http://www.example.com/mydirectory/page2
http://...
6
votes
6
answers
5k
views
How can I use pathauto to generate URLs for deeply nested vocabularies?
I am generating breadcrumbs from URL arguments as described here.
I have a vocabulary that looks like this:
Arts-> Performing-> Dancing-> Ballet
I want my url to look like this:
arts/performing/...
6
votes
8
answers
6k
views
Bulk update for unchecked "Generate automatic URL alias"
I have a lot of programmatically generated nodes with the option "Generate automatic URL alias" unchecked, so i can't use the Bulk Update of the pathauto module.
How can i to bulk generate the ...
6
votes
3
answers
16k
views
Convert link from node/nid to Pathauto url?
Im using Pathauto to make my URLs nice and I may want to change the paths in the future. On some pages Im manually lining to other nodes.
The issue is that if I code the nice URL then the link will ...
6
votes
3
answers
6k
views
How to remove url alias when node is deleted
I am using Pathauto. When I deleted a piece of content, I was surprised to find that its url alias was still mapped to the now-nonexistent content (node/xxx).
How can I have this alias and System ...
6
votes
3
answers
4k
views
Use entity_uri or drupal_path_alias()?
What are the difference? And when should you use which one?
entity_uri() is rather new to me (Drupal 7) and I see it little used. But it appears to be a lot cleaner and better performing then ...
6
votes
3
answers
2k
views
How can I get final URL of newly added node from hook_node_insert()?
I have installed pathauto and implemented hook_node_insert in my module, the problem is when I use entity_uri to get new node's URL I will get node/xxx instead of pathauto url alias.
How can I get ...
6
votes
1
answer
2k
views
How do you hook into a path being created via pathauto?
I can't seem to make hook_pathauto_alias_alter() get called in my custom module, in either 1.x or 2.x. I'm not certain, but I'm not clear if this hook is even in pathauto 1.x.
I am trying to hook ...
6
votes
2
answers
7k
views
Changing URL alias for search module action
I'm struggling to make the Search module recognize the presence of a URL alias that I created for 'search/node'. It however stubbornly uses the default path.
In my template I use something like:
...
6
votes
3
answers
3k
views
More than one path alias per node
I have a ticketing system where the path aliases are set like ticket/[node ID], e.g. http://example.com/ticket/1234.
I would like to create multiple path aliases for the same node, and be able to ...
6
votes
2
answers
881
views
Node alias with taxonomy term
I have the content type 'machine' that uses two vocabularies (producer, category).
I would like to create node alias like [language]/machines/[producer-name]/[title-raw]; [producer-name] is from the ...
6
votes
2
answers
5k
views
Context Filter with Path Alias in URL
Quick Summary: how do I pass a alias in a URL to a view's context filter, when that view is located somewhere in the site.
I've read dozens of similar articles, but nothing that directly makes this ...
6
votes
2
answers
2k
views
How to deal with deleted posts: Returning 410 status and preventing path re-use
For my jobs site, I want to return 410 status for those jobs which expire or are removed permanently. How can I do it so that 410 instead of 404 is returned for say job related node types( they'll be ...
6
votes
1
answer
1k
views
An alternative for pathauto and token
I'm considering alternatives to pathauto module for automatic URL alias generation.
The reasons I want to stop using it are the following:
Most of the aliases are [node-type]/[node-title] so I do ...
5
votes
2
answers
4k
views
How do you delete a content type's URL aliases in bulk?
I have a content type where I want to delete all of its URL aliases in bulk. Currently the pathauto url alias page only has the option to delete all content url aliases regardless of what type it is.
...
5
votes
3
answers
4k
views
How to bulk update existing path alias after changing the URL alias pattern?
How to bulk update existing URL alias?
I have Path auto module add path alias to URLs. I have changed the URL alias pattern. Now I want to update the pattern of old URLs also.
How can I achieve this?...
5
votes
3
answers
8k
views
Can I display all token values available for my Drupal installation?
Is there a way that I can display all possible values for tokens available on my Drupal installation? For example, I'd like to see all of the possible values for the [termalias-raw] placeholder that I ...
5
votes
2
answers
4k
views
How to check if page exists using page alias in D7?
In D7, how do I check whether a page exists by page alias? I've found some guy asking the same very question but I have problems with using menu_valid_path() (or drupal_valid_path() in D7) function. ...
5
votes
1
answer
226
views
Is there a better way to create an alternative URL Alias Pattern?
Say for example my alias pattern for one node is set up as:
style-[node:field_style]/[node:title]
There may be a case that node:field_style is blank so I would like to use another field and a ...
5
votes
2
answers
361
views
Build StackExchange-style url's
I'm looking for a way to build what I call 'StackExchange style' url's with Drupal 7. In my definition, that means:
A node has a path alias containing both a unique identifier and the node title. For ...
5
votes
3
answers
1k
views
View's path prevents 404 page from showing
D7, Views 3. I'm kinda puzzled with how Views path work. I have these paths at my site:
mysite.com/people - a view displaying a list of all people
mysite.com/people/alice - an article about Alice
...
5
votes
2
answers
3k
views
How do I mimic Pathauto transliterated output for an alias in my custom PHP code?
When writing my custom function I need to manually append node name to a taxonomy term link. To get the taxonomy term part done I use:
$link_uri = taxonomy_term_uri($term);
$path_alias = ...
5
votes
1
answer
2k
views
Alias not working for a non default language
When I create a node in a non default language, I set an alias. After the node is saved, however, all internal links (e.g. menus) do not use the alias; they all use the node/[nid] link type, and when ...
5
votes
1
answer
269
views
Make variables outside of node available to pathauto
I'm trying to port a website over to Drupal 7. The structure consists of locations which have an entity reference to a region which has an entity reference to a country:
location<-region<-...
4
votes
2
answers
8k
views
What are the URL Alias pattern replacements for taxonomy parent terms when building up Node paths?
SCENARIO:
I created taxonomy terms with 3 depth levels. Example:
Term 1 ( Root )
Term 2 ( Child of Root )
Term 3 ( Child of Term 2 )
In the URL Alias for my vocabulary I set:
[term:parent:...
4
votes
6
answers
8k
views
How can i enable automatic path creating for all nodes?
In Drupal 7.12 i use pathauto, cleanurls, transliteration, i18n.
When i edit one node i saw that, "Generate automatic URL alias" in unchecked.
Then i checked other nodes and saw that for all type of ...
4
votes
3
answers
9k
views
Path alias tokens and node references
I'm trying to figure out if path aliases are even capable of what I'm trying to do, or if I need some other sort of module.
I have a content type "project" and a content type "mockup". A "project" ...
4
votes
2
answers
7k
views
Create Alias URL to taxonomy term page with TID
I am trying to figure out how to create a url-alias friendly url to a taxonomy term page with only the tid of the term. I know drupal does this automatically in the node, but I am trying to do this in ...