3

I am using Drupal 7 and have been trying to figure out following:

How do I make a menu link to the latest article that has been classified with a certain taxonomy term? For example, I want to have a menu link called ‘Lifestyle’ and by clicking that I expect to get the most recent article classified with taxonomy term ‘Lifestyle’. For SEO purposes I prefer if the menu link would contain the title of the article.

I tried to do this using Views module with basic filters, but I have some issues with this approach:

  1. As a result I do get a latest article with a certain taxonomy term, but the page title is displayed twice (the first one is a link to article itself). How do I remove this properly in a Drupal way (I don’t want to use CSS to hack it).

  2. Also, as a result, Views generated URL that looks like this: http://www.mydrupalsite.com/articles/latest/1 (where 1 is a taxonomy term id). I would like it better if the URL would point directly to the node like this: http://www.mydrupalsite.com/articles/the-article-title-here

Any ideas?

Thanks.

1

For your first question:

As your are displaying "Teaser" view of the node in your view, so you are getting two title of the node. If you want to hide the "Title" of the node and display the override title, then you can follow the below step.

  • Go to Administration -> Structure -> Views
  • Edit your views "latest"
  • Click on "Content" in "Show" setion under "Format" section of your views, it will display the popup.
  • Select "Fields" from form which is opened in popup and save the form.
  • Now, you will see "Title" and "Body" in your "Fields" section.
  • You can remove the "Title" from views or Edit "Title" fields and check "Exclude from display" check-box, so it will not display in views.

For Question 2:

If you want to append latest node title with path (latest), then I do not think, there is solution for this.

But, if you install "pathauto" module, then you can create url alias for the same or you can append term name with view path and can get term id for the term name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.