ashwani46
ashwani46

Reputation: 49

Adding link with button in drupal

I want to add a button in my drupal website which can redirect me to any specified article/page. Any suggestion will be helpful.

Upvotes: 0

Views: 1983

Answers (2)

Altef four
Altef four

Reputation: 370

Use the Link module.

It allows you to add a field to your content type that has an href value and a Text value. Then you can change it's display output to output title as link which will output a hyperlink with the text you selected, and once clicked will redirect you to whatever href you set.

If you want to style it to look like a button you can add a CSS class to the Link field you added in your content type under manage fields >> Edit the link field.

I am using Bootstrap subtheme so the button CSS classes are already there for me. i simply add btn btn-default if I want to show a button instead of a hyperlink.

PS: DO NOT CREATE BUTTONS IN A BLOCK. Classes should never go into a block. And if you have clients who are going to use that site, they can mess stuff up pretty fast.

Upvotes: 1

Sagar
Sagar

Reputation: 647

Create Block and put html code for button in block. Enable block on pages where you want.

While putting html code of button into block, please make sure that you have selected "Full Html" filter.

Upvotes: 0

Related Questions