Drupal generates long links - drupal

My drupal site generates long links like:
example.com/drupal/blog/what-we-do/solutions/about-us/
This link works and shows the blog page:
example.com/drupal/blog/
how can i get rid off these kind of links?

Disable the path module in your Drupal installation.
If you want to keep using the path module and delete only some of your aliases visit the page admin/config/search/path and delete whatever you want.
When you create new content you can uncheck the automatic alias generation and blank the text field where you write the alias.
You will still be able to access the content by using node/[NODE_ID]

If you want to do that automatically depending on the type of content, I think you can use pathauto
The Pathauto module automatically generates URL/path aliases for various kinds of content (nodes, taxonomy terms, users) without requiring the user to manually specify the path alias.

Related

Prepopulate Content Type Args when going to /admin/content in Drupal 7

I created a Drupal site. The admins who will be using the site for content management have no Drupal knowledge and I have been tasked with making this as easy as possible for them. I'm creating an admin control panel and I want a quick link that takes them to the admin content page, but with the "content type" prefilled. For example, for content I have pages, events, resources, and testimonials. I want to provide them with a quick link for editing content type EVENTS only. So it would go directly to admin/content with the type filter set to "events". The URL does not currently add args or anything like that.
Anyone know of a way to do this?
yes you can do this- just use this module: Drupal admin views which supports a REGULAR VIEW for admin/content. The View is set to use ajax though- just remove this option and save it and call /admin/content then. There you will see the resulting filters in the URL (you can even set their keys to a value you like inside the view). Set back to use ajax (if you like) and use the keys in the URL for type it's simple just call /admin/content?type=YOURTYPE

Drupal Content Type field for spreadsheet

I am working on a Rental Home Listing website, where "Rental Home" is a content type with CCK fields.
I want to add a new field called 'Maintenance Log', which will be accessible only to the administrators and will be used to keep track of all maintenance work done on a home; it would have some functionalities a spreadsheet has.
I have already tried SheetNode & table types, but I ran into issues. Can anyone suggest a better alternative to implement this?
I would recommend using the node_reference module which ships with CCK so all you have to do is enable it.
you would then create a new content type for maintenance logs, add a node_reference field to it that can reference nodes of type "Rental Home".
when someone has performed maintenance work on a home they would simply create a new maintenance log and use the reference field to reference the house in question.
then you can display these in a suitable way, using Views or the like.
if you'd like you can use the content access module to handle who can view the maintencene logs. you should also look at the content permissions module which also ships with CCK, it will allow you to specify access to specific CCK fields instead of the entire content type.

Intercept Drupal path in custom module and show data from external source, even if no node exists

In my custom Drupal module, I want to intercept the URL to show custom data derived from an external (in this case, XML) data source.
For example, let's say I wanted to create a Flickr front end on Drupal. I could browse photosets through my Drupal front-end, and I could comment on them (using node data inside Drupal).
If a user browsed to /flickrphoto/12345 - maybe I don't have any nodes in Drupal which corresponds to that URL, however, I want to intercept it and look up info on Flickr using data from the URL and NOT show a 404.
I can use the Drupal request_uri() in my module, but that doesn't seem elegant. I'd like to use path or pathauto as well, to all users to determine the URL scheme that directs to my module to ascertain the data that should be shown from the external source.
Thanks!
Since the 404 handle is done automatically in Drupal, you need to create a new entry that will match when the one from the custom module doesn't. This is done with hook_menu. In the page callback you can handle what should happen when the node doesn't/do exist.

Adding Path Field to a CCK Content Type

I am completely blanking-out.
I want a content type to have the path field, so I can alias its path from node/n to /foo.
I can't seem to remember how to do this. When I go into Content>Content Types>Edit My_Content_Type, the path field is greyed out and doesn't display when I view an instance of the content type.
I made sure paths module had the correct permissions, but no-go.
How do I get the 'path' field to show up when creating or editing a custom content type?
Path is not a CCK field, it is it's own system, even in D7. It is used just for path aliases so won't, usually, be displayed in a node.
As Nikit suggests, pathauto may cause the box to be grayed out. Also I suppose you should make sure the path module is turned on.

Creating custom paths in Drupal

I'm trying to create custom URLs for my menu items, such as mysite.com/aboutus rather than /node/2 or however it has it by default. In the menu configuration I changed the paths to what I want them to be, but I don't know how to change the paths of the pages to a custom name, rather than what Drupal defaults it as.
Turn on the Path module, and download Pathauto. You can then create aliasing rules per content type, users, and taxonomy, and you can forget having to do this ever again.

Resources