3

I want to create a field that is automatically filled with the current page URL, and displayed as a link. The user should not be able to change that field. How can I do this?

If coding is required, please describe exactly what, and where to code.

2 Answers 2

2

Have a look at the Link module, it defines a link/url field. If you have the Token module, you might be able to use [site:current-page:url] as a default value for the field.

1

The link module accepts tokens.

I used it many time to build url in some of my content type to pass on the value of the [node:id].

If you want to have the current url you have to use [current-page:url].

In the default value of the link module write this http://example.com/[current-page:url:path], and you will have the good result. I just test on my website (so don't forget to write your domain).

[Link module]]1

2
  • I just edit my post now it's work fine
    – Epok
    Commented Aug 29, 2012 at 16:23
  • Thank you very much Epok, this works. I created such a field in the private message form so that I can send to the recipient a link to the node. But now the problem is that once the user got the message, the link points to the message and not to the original node. Any idea? Thank you very much for your help!
    – Nico7
    Commented Aug 29, 2012 at 16:39

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