How do I create a link to allow users to add a specific content type when viewing a specific View.

I create a View to list all nodes of the content type "Blog". Within that View, I also want to add a link on the top to allow users to add a blog post...

For example, see the screenshot below. This is the default Blog view for the Open Outreach distribution. I can't figure out how they created a link on the type that says "Add a new blog post". In addition, I also noticed on the right side there is a block called "Content shortcuts". That block only shows up depending on the user role. In the screenshot below, the user belongs to "blogger" role so he is able to see that block. However, if I logged in as admin, I won't be able to see that block.. .



Krishna Mishra’s picture

You can add a header(Global text area) in your views and put simple HTML code Like: "a href="/node/add/specific content type"Add A New Content "/a .


Zythyr’s picture

But the OpenOutreach didn't use that method...

I looked at the View that openOutreach created to list all blog post. Their header and footer is blank.

wusel’s picture

You can add a header(Global text area) in your views

You know what to add means?


Zythyr’s picture


I know that Krishna suggested to add the link manually in the header. I think that would resolve the problem. However, I am still trying to figure out how Open Outreach managed to add the link without manually adding the link in the header of the View.

paean99’s picture

Open Outreach did it with Debut Blog module/feature/app. That link is a local task added by code. You can see it in the file debut_blog.module at line 12

 * Implements hook_menu_local_tasks_alter().
 * Add an action link to 'node/add/blog' on 'blog' page.
function debut_blog_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  if ($root_path == 'blog') {
    $item = menu_get_item('node/add/blog');
    if ($item['access']) {
      $item['title'] = t('Add a new blog post');
      $data['actions']['output'][] = array(
        '#theme' => 'menu_local_action',
        '#link' => $item,