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].

Filter by
Sorted by
Tagged with
6
votes
2answers
8k 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://...
70
votes
9answers
122k 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?
19
votes
3answers
15k 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 ...
4
votes
3answers
8k 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" ...
14
votes
5answers
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 ...
6
votes
5answers
4k 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/...
4
votes
4answers
10k 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="{{ ??????? }}">{{ '...
3
votes
4answers
3k views

Pathauto for a multilingual site not generating alias for non-default languages

I have a site with 90% content in Chinese, and only 10% in English. Thus the requirement of the client is that when viewing an article in English, everything around it remains in Chinese. Blocks, ...
2
votes
1answer
72 views

How to automatically skip intermediate redirects?

I've run into the issue where I end up with something like this: about-us01 --> about-us02 --> about-us The correct path is "about-us". But due to admins changing things I have ended up in a ...
2
votes
2answers
441 views

How to create a redirect to point to the user's id?

I'd like to create a redirect so when the user hits mydrupal.com/my-account its redirected to mydrupal.com/users/3 I'm using Pathauto and I know I can go to admin/config/search/path/add to add the ...
11
votes
2answers
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 ...
7
votes
3answers
3k 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 ...
8
votes
4answers
28k 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, ...
4
votes
2answers
3k views

Routing and path aliases

I have created a module with its routing.yml file. mymodule.dossier: path: '/dossiers/{node}/dossier' defaults: _entity_view: 'node.dossier_dossier' requirements: _permission: 'access ...
2
votes
1answer
3k views

Using Pathauto URL alias in link fields

In a view, I have several fields that I would like to link to the original content. The title field's default behaviour is like this, but I want to have the trimmed body and the image fields to behave ...
6
votes
2answers
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
3answers
15k 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 ...
4
votes
1answer
2k views

How to automatically generate multiple aliases for one node?

I'm using Drupal 7.22. I'm running four site versions in same Drupal installation. eg:- example.com/site1 example.com/site1 and its mobile versions: example.com/mobilesite1 example.com/...
1
vote
5answers
5k views

Override taxonomy term path with Views

I need to override by views my hierarchical taxonomy term paths: www.example.com/[vocabulary name] www.example.com/[vocabulary name]/term1 www.example.com/[vocabulary name]/term1/term2 www.example....
12
votes
6answers
16k views

Is it possible to programmatically add a path alias to a programmatically created node?

I have created pre save hook in module which is populating my node by fetching information from various API's. However I can't get my mind around how to add node alias to newly created node. Is there ...
5
votes
1answer
2k 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 = ...
3
votes
5answers
6k views

Rebuild all paths for a content type

I want to change all paths for a given content type. For example is would change all node of type "image" that are currently at /[some_token]/[nid] to /photo/[nid] I am using path auto and I ...
3
votes
2answers
2k views

Redirect all subpages back to the front page

I am trying to redirect everything that is under example.com/pictures back to the front page (i.e. I am hiding picture nodes to be directly viewable). Neither the Pathauto module nor the Global ...
2
votes
2answers
5k views

How create Redirect pattern from old to new URLs?

D7: I'm going to update an articles path pattern (/articles/[node:uid] → /post/[new tokens]) but I need redirect users from old path to new one using tokens. And I don't know how to do that. I tried ...
0
votes
2answers
2k views

find Menu Settings of node, given URL alias (or node ID)

In the Drupal 8 screen for editing a node, we have these two sections: URL Path Settings > URL alias Menu Settings (Menu link title, Description, Parent item, Weight) How, given the URL alias of ...
0
votes
1answer
410 views

I see all aliases besides the home page alias (At URL bar)

Why is that? I mean, why when I click the home page link at main menu, it is only the site's URL (www.example.com), and not the exact URL of the home page (www.example.com/Decorations-for-all-houses) ...
4
votes
2answers
7k 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:...
5
votes
3answers
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
3answers
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 ...
14
votes
3answers
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')...
10
votes
8answers
15k 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 ...
6
votes
4answers
5k 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?
6
votes
7answers
5k 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
2answers
1k 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 ...
5
votes
3answers
3k 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?...
4
votes
2answers
153 views

URL alias, tokens is replacing 0s and 1s with node and entity [duplicate]

Has anyone seen a case that url aliases or tokens end up replacing certain numbers in a url with the words node and entity. A UTC Timestamp in my url ended up replaced like this: ...
3
votes
2answers
2k views

How to support legacy url alias' and/or support multiple url alias' (Conditional Pathauto?)

I am migrating a site from wordpress and need to preserve my url structure whilst supporting native pathauto urls in the future (for new content) Overall Drupal's clean url process is almost ...
3
votes
1answer
4k views

Pathauto taxonomy terms in content paths

I'm using pathauto and want to set it up so that when a new page is created (which has the taxonomy field) it will add the taxonomy terms into the url. For example, if I have the following vocabulary: ...
3
votes
2answers
2k views

Views won't handle my pathauto pattern for taxonomy pages

I have two taxonomies on my site that need to be browsable independently using different Views. Therefor I decided to prepend the term paths with the vocabulary name. In PathAuto patter section I have ...
3
votes
1answer
6k views

Programmatically create alias using pathauto for node

Developing a site that allows users to post images (node type = my_image) to a specific category. Basically, we create the categories and users submit images to them. Users do not have menu or url ...
2
votes
2answers
114 views

How to get node IDs from drupal.org?

In Drupal, we can get argument values using arg() function. drupal.org uses path alias. For example https://www.drupal.org/project/elysia_cron is actually https://www.drupal.org/node/274365, the node ...
2
votes
1answer
625 views

Setting up catalog taxonomy

I'm fighting with pathauto patterns for a particular content type. The content type is bound to a taxonomy (a product catalog). I thought that the taxonomy tree should only hold container items (...
2
votes
4answers
7k views

Views: URL Alias as a field

How do I get the URL alias of a node in views. Here is a previous question, Get a url alias as a field value? However, the Content: Link field outputs something along the lines of <a href="url"&...
2
votes
2answers
930 views

Find Menu Link Title given URL alias, to replace node Title in breadcrumbs

In Drupal 8, how can one determine the Menu Link Title of a node, given its URL and other information like its route & parameters? This is to modify the core path-based breadcrumbs (...
2
votes
1answer
894 views

Twig template suggestions for paths such as page--node--page-url

using D8, I'd like a twig template for a page I've created based off the path of the page and not node %. I look in my twig suggestions and all I see are: page--node--8.html.twig page--node--%.html....
1
vote
1answer
890 views

URL alias for taxonomy in drupal 7

On a Drupal 7 site with pathauto installed I'm using a view to show all taxonomy terms of a given node. The terms are linked to the term's page. The problem is, that the path of those terms does not ...
9
votes
1answer
7k 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
3answers
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....
4
votes
1answer
6k views

Path (URL) to call custom module function

I am developing a custom module and I need an URL that would trigger an action when called. The purpose is for an external server to call this address passing some variables through $_REQUEST['...
4
votes
1answer
675 views

How to use url alias in views for taxonomy terms?

On a Drupal 7 site with pathauto installed I'm using a view to show all taxonomy terms of a given node. The terms are linked to the term's page. The problem is, that the path of those terms does not ...