This is a work around for creating a custom look for a node landing page of a content type with the views module.

I have seen that there are various modules like display suite and contemplate that you can use to create a custom design for node pages, and if you edit the node-CONTENTYPENAME.tpl.php you can make a custom look for each page of the content type. In a lot of cases I would suggest using those modules and techniques, but in some cases you can just use views, and I find that it is not only a lot easier but there is a lot more flexibility in using views. You can add, modify and create dynamic elements that you otherwise could not.

I setup this view for a job posting I had on one of my sites. There is a content type to "create a job". This creates jobs for the site and has a few fields. You can add whatever field you feel of worth, the only important one in this tutorial is the title field.

In the views I created a new view -> type = node and setup a few default values.

Filter: Published = yes
Filter: Type = create a job
Fields: Title

I am not going to include the rest of my setup because essentially all you need is that (bear in mind that you would probably add fields to the "Job page" which we will create later).

I then add a display of type = "page". This has all the elements from the default I just created, and will display a list of all the jobs created by the administrator. I used a style table in my site but you can use whatever you like.

This is where it gets interesting.

On my title field I "Output this field as a link" and create my link value as "jobs/[title]"
the "jobs" part of the url is a standard for my site and you might not use this. The important part of this is the replacement pattern "[title]" (I think you need the token module for this - if you don't have it installed, get it. It is now part of drupal 7 because it is that awesome). This links to the page we are going to create in the next part. (I should mention that this would need tweaking if you are NOT using clean-urls - I am not going to go through that because you should have clean-urls)

Now create a new display of type "page". This is going to be your new look for your NODE. Now instead of users navigating to the standard drupal node page they will be directed to this view.
So now you add fields and filters how you like and create your page in a style you like.
IMPORTANT: You need to limit this display to 1 "Items per page: 1" so that no other elements from other pages are brought into this new "NODE" type page.

So now you have styled your page (NODE), made it to display only one, but how are the users going to navigate to this page (VIEW) based on the previous view display where you created a custom output link?

In the "Page settings " the path must change to (in my case) "jobs/%" . The % is a wildcard and because you have your list display with the title of the page .. that then links to this wildcard! epic views rules.

So now you have a view which is your content type landing page which you can tweak to your heart's content instead of the static based page that is defined by drupals internal something or other.
I think you can also create an attachment which would work just as well but .. not sure.

Your default node page still exists in drupal but because users are navigating to the page based on the previous view they never get to that page (NODE), only the view based page (NODE)

(not sure if i used page and node in the "drupal way" for this. hope its clear enough to understand)

/***************/
/* UPDATE */
/***************/
I was messing around with this procedure and found a minor error when using pathauto ( which i am sure most people use ). If the title url link has the same setting as the pathauto link this might not work. I say might because on two occasions it has worked. I do not pretend to understand this but from what I do know that NODE page still exists and so I guess drupal wants to link to it. If the url is different there is no conflict. Also consider using the [path] replacement setting by adding the field->Node:Path .

To carry on with my example.
My pathauto settings were "/work-with-us/[title-raw]"
so now using "/work-with-us/[title]" it would still refer to Drupal's NODE. I changed the url to "/work-us/[title]" and on the jobs page I changed the path settings to "/work-us/%" and everything works fine. So, I guess no toes are being stepped on in this manner.

urls MUST NOT be the same as the pathauto urls.

Comments

larsotten’s picture

If I create content I can only add a homepage. I need to create (or duplicate) basic pages.

It seems the default is when I select Add content, I automatically create homepages. What I want is duplicate the following page;

http://alondres.es/hoteles

Any suggestions?

Thanks in advance

Anonymous’s picture

Hi Larsotten

Your question is rather vague and i am not to sure what you are trying to do. From what is sounds like you want to just create a normal ... Node. By default on a drupal install your "create content" -> "page" will be set to "Promoted to front page" under "Publishing options". You can uncheck that box and your pages will not go to the front page. In the "menu setting" of that page you can set your page to a menu and then navigate to it with the main menu on your site.

So looking at the link provided if seems like you would want to create a view and do a bunch of stuff that would take a while to describe here.

I highly recommend you check out http://drupalize.me/

amogiz’s picture

Hi !
I am looking for this for many weeks, but after reading an reading could not make it work.
I fact,
- don't you need Arguments for this ?
- my links for [title] may have accented letter, and cap, so the url is never OK.

Maybe i Have misunderstood something.
Any help will be great :)

Anonymous’s picture

1. Arguments ( as far as I am aware ) are an advanced way of filtering content based on well .. arguments . I think there is a way which you can do this, but and this is a big BUT, you need to use panels to pull that information.
2. In that case I am not sure it will work unless you use the [path] field from the content filter in the view. And then you might need to tweek it to absolute path or not depending, I havnt actually tried that.

Since i posted this article I have been working with panels a lot and find that panels is actually a better solution because you can setup your custom page display like the article by just added content and then base all of that content on arguments and its really flexible now with content panes in views. So a small blog site i would still probably use this though. Although a lot has changed with drupal 7 and the context modules is also a good solution.

check these tutorials out on page manager i think it might be what you are looking for http://nodeone.se/blogg/learn-page-manager-1

amogiz’s picture

Really thanx to have answered me.
I was about to use Panels that i know from D6 but (Why ???) it does not work here …
I think there are bugs because when i try to add any Panel Page the link is not good.
By the way this another problem :)

Thanx

Anonymous’s picture

That is rather strange. Do you create a custom url in the page manager settings?

amogiz’s picture

The problem with panel was a module conflict.
In some case, and I think I won't be the only, it won't work.
By the way, Thanx to you !

Anonymous’s picture

A conflict with the panel module? that does not seem likely. Was it a custom module?

v8powerage’s picture

You need argument Node->NID

Lan’s picture

Hello. thanks for your content. i want to do same thing here, but after following the instructions from the content. the titles from the first Page of the Views all linking to a same content of a node from the second Page of the views. I can't figure out. Please help. Thanks.

ajeya1988’s picture

Hi Lan

Add a contextual filter in the 2nd view that will link that term with 1st view