I need to know the current page url in a shortcode
17 views
Skip to first unread message
gian paolo ciceri
unread,
Mar 16, 2017, 8:28:13 PM3/16/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nikola-discuss
Hi all,
sorry for the newbie question, but I need to know what have I to do to get the current page (story) url in a shortcode that I'm calling from this page itself.
I've tried with something like abs_link(permalink), but with no success. It seems that "permalink" is None.
Shouldn't be a variable in GLOBAL_CONTEXT?
Thanks for your patience.
Best Regards
/gp
Chris Warrick
unread,
Mar 18, 2017, 1:44:09 PM3/18/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Nikola—Discuss
permalink is part of the local context of every page. Because of how
shortcodes work, Nikola cannot offer `permalink` there. However, you
can use the post object to do what you want — the method is
post.permalink() .
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to nikola-...@googlegroups.com
Thanks!
It works. One-line-patch. Yes.
Regards
/gp
"Antiochus, when he was Ephor, hearing that Philip had given
Messenians their land, asked if he had also provided them with the
power to prevail in fighting to keep it." (Plutarch, Sayings of
Spartans)