如何在Drupal视图中设置URL别名作为内容标题链接?
Got it, let's walk through this step by step. You've already got your taxonomy set up, content associated with terms, and your view showing category titles—now you just need to make sure those content titles link to your clean custom aliases instead of the default node/XX URLs. Here's how to get it done:
Step 1: Set Up Custom URL Aliases for Your Nodes
First, you need to create those aliases for your content. You can do this manually for individual nodes or automate it for bulk content (way more efficient).
Option 1: Manual Alias Setup (For Individual Nodes)
- Head to the edit page of the node you want to alias (like
node/19/edit). - Scroll down to the Path section—if you don't see this, make sure the core Path module is enabled (check at
admin/modules). - Type your custom alias into the URL alias field, exactly like
artist-works/Robert-Boynes/Infinite-Red. - Save the node. Now visiting
http://localhost/drupal7/artist-works/Robert-Boynes/Infinite-Redwill load that node instead of the default URL.
Option 2: Automatic Alias Generation (Bulk Content, Recommended)
If you have lots of nodes, use the Pathauto module to generate aliases automatically:
- Install and enable Pathauto (plus its dependency Token) via
admin/modules. - Go to
admin/config/search/path/patternsto create a URL pattern for your content type. - For example, if your content type is "Artwork" and you have a taxonomy field called "Artist", your pattern could look like this (use the token browser to pick the right fields for your setup):
artist-works/[node:field_artist:name]/[node:title] - Save the pattern, then run the bulk update at
admin/config/search/path/update_bulkto generate aliases for all existing nodes.
Step 2: Configure Your View to Use the Aliased Links
Once your aliases are set up, make sure your view uses them for content title links:
- Edit your view at
admin/structure/views. - Find the Content: Title field in your view's field list and click to edit it.
- Under the Link field to dropdown, select Content (this is usually the default, but double-check it's not set to something else).
- Save the field and save your view.
Troubleshooting: If You Still See the Default Node URL
If the links are still pointing to node/19 instead of your alias, try these quick fixes:
- Clear Drupal's cache: Go to
admin/config/development/performanceand hit "Clear all caches". Drupal caches URL aliases, so this often fixes the issue right away. - Check Path module status: Ensure the core Path module is enabled (it should be on by default, but sometimes it gets turned off accidentally).
- Resolve alias conflicts: Head to
admin/config/search/pathand make sure there aren't any other aliases pointing to the same node—Drupal will use the one with the highest priority.
Pro Tip: Leverage Taxonomy in Your Aliases
Since you're using taxonomy, including term names in your aliases (like we did in the Pathauto example) makes your URLs more descriptive, user-friendly, and better for SEO—perfect for your artist works setup.
内容的提问来源于stack exchange,提问作者Manmeet Khurana

