Skip to main content
9 votes
Accepted

Is it possible to set any attributes (such as a class) of the `a` tag when using `getLink()`?

No, getLink outputs a very simple version of the link. If you want something more complex, you'll need to build it manually... <a href="{{ foo.url }}" class="bar">{{ foo.title }}</a>
Lindsey D's user avatar
  • 24k
6 votes

Is it possible to make links open in a new tab by default?

Merits of doing this aside, I agree that JS is probably the easiest way to go here. This code adds target="_blank" to all external links. // Make sure any offsite links (non js/mailtos) open in a ...
Jeremy Daalder's user avatar
6 votes
Accepted

How long does the share link on the entry edit screen last?

24 hours by default, but it can be configured via the defaultTokenDuration config setting. v2 documentation v3 documentation
Brad Bell's user avatar
  • 67.5k
5 votes

Plugin "Typed Link Field" -> Alternative for Craft 5?

You can somewhat replicate it in 5 with an Entry Type and conditional fields that only expose the particular field based on the value ofa dropdown for type selection. I'm not sure how efficient that ...
Matt Wilcox's user avatar
  • 3,209
4 votes
Accepted

How can I let the user activate a particular SuperSort filter

So in order to do this you have to reformat your code and your strategy a bit. You cant provide a Craft query as a link, all that does is grab an array from the database and it won't inherently print ...
Alan Miller's user avatar
4 votes

Not a Craft CMS designer and need help

Craft often requires a different approach than Wordpress, but can be just as easy and powerful to use when set up correctly. The big unknown in your situation is how your content architecture and ...
Ben Parizek's user avatar
  • 13.5k
3 votes
Accepted

How to keep the setPasswordPath config when reset password link is expired?

Pretty sure the invalidUserTokenPath config setting is what you're looking for.
Brad Bell's user avatar
  • 67.5k
2 votes
Accepted

Is it possible to make links open in a new tab by default?

In Craft 3, you can set "linkNewtab": true and "linkTarget": "_blank" in your redactor config. This should default so the "Open in new tab" is automatically checked when creating links in a redactor ...
Jeff Irwin's user avatar
2 votes

Check the site for missing file links / warn user before removing used files

is there a way to check the site for missing file links, including those in redactor? I can't think of a way to do this outside of writing a custom plugin/PHP script that loaded everywhere an Asset ...
Brad Bell's user avatar
  • 67.5k
2 votes

I need to update an existing URL

You can replace a file directly in the control panel. Navigate to Assets, select the file you want to replace and then click the cog icon to select the “Replace file” action.
carlcs's user avatar
  • 36.3k
2 votes
Accepted

links to another website without my own url

I assume that subHeading is a plain text field. Just a guess, are you inserting a string that can be interpreted as a relative path on your website? Ex. google.com vs https://www.google.com The ...
Alessio Breviglieri's user avatar
2 votes
Accepted

Omitting repeated content in a for loop

Currently you are trying to compare objects with each other and of course they are always different since they have a different reference. entry.vendor is not a single selected value but the field ...
Robin Schambach's user avatar
2 votes
Accepted

How to link to an entry in a Markdown field in the CMS

I just figured out how to do this. It was vexing me! Anyway, Craft is awesome and has provided support for Reference Tags. Write your Markdown like this: [link text]({entry:20}) Here's the Twig: {...
plaintxt's user avatar
  • 488
2 votes
Accepted

How to assign entries to static positions such as footer?

This sounds like a perfect use case for an Entries field in a Global. I'd create a field called "Footer Links". At the bottom of the field settings page, expand the Advanced area and enable Manage ...
Jamie Wade's user avatar
  • 3,644
2 votes

Adding an external link to a menu (beginner)

You need to figure out how the navigation is created in the template. It could be completely hard-coded in the template, in this case you would have to manually edit the template to add your ...
MoritzLost's user avatar
  • 11.5k
2 votes
Accepted

How to add the option for a link to select a target, e.g. open link in new window? [CKEDITOR Plugin]

Don't include EditorClass.create in the JavaScript config. Creating the CKEditor instance is handled by the Craft plugin. The JavaScript code in the configuration should just return an object with ...
MoritzLost's user avatar
  • 11.5k
2 votes

Plugin "Typed Link Field" -> Alternative for Craft 5?

Currently my plan is to build a matrix field in Craft5 but I would appreciate it that we have something within the core.
davidhellmann's user avatar
2 votes

Plugin "Typed Link Field" -> Alternative for Craft 5?

There's several paid plugins, "Link It" is popular and has been around through a few versions of Craft. Hyper is newer but has had good reviews. I'll also provide a link to the CMS feature ...
cherrykoda's user avatar
  • 1,114
1 vote

Linked pages can't load entry-variable

The Twig Runtime Error – Twig\Error\RuntimeError Variable "entry" does not exist. typically happens when the variable has not been declared on the twig file getting pulled. Its hard to ...
kelly's user avatar
  • 71
1 vote

Next previous page links

You could consider twig's |filter to filter your array. {% set reviewPages = craft.entries.section("reviews").all() %} {% set validReviewPages = reviewPages|filter(page => { page....
Max Strebel's user avatar
1 vote

Redactor // "Link to an entry" not available

Oh my ... sometimes it's just too easy. :/ The items in the Redactor Link Options were just hidden with CSS.
Marc 's user avatar
  • 194
1 vote

Redactor // "Link to an entry" not available

Does your site have any sections? The link to entries option is only visible if there is at least one section to select entries from. To find out more, you can use the EVENT_REGISTER_LINK_OPTIONS ...
MoritzLost's user avatar
  • 11.5k
1 vote
Accepted

Matrix field entry link corrupted

You're outputting an unexecuted Element Query. To clarify - the thing stored in your Entries field named buttonLink is not a Craft entry as you might expect, but is basically a raw unexecuted database ...
James Smith's user avatar
  • 5,344
1 vote
Accepted

LinkIt: transform content

Not super familiar the LinkIt, but there is a feature request for email obfuscation here: https://github.com/fruitstudios/craft-linkit/issues/58 you can comment on and you can make a new one for phone ...
Brad Bell's user avatar
  • 67.5k
1 vote

Saving a "craft-linkfield" field via an entry form

Found a solution by inspecting the HTML for the entry edit form in the CP. This works: <input id="fields-website-type" name="fields[website][type]" value="url" type="hidden"> <input id="...
Udo's user avatar
  • 607
1 vote

Page is Not listed in Backend

Since you said this “page” is merely a link to an external site, you’re not going to see it in the Entries section of the Control Panel. Most likely this page/link is being setup either in some menu ...
Jalen Davenport's user avatar
  • 3,045
1 vote

Changing the label on links

This is highly dependant on how the fields and templates are set up. You don't say how you are creating the link. Craft makes no assumptions as to how you are going to be entering content. It's ...
foamcow's user avatar
  • 2,029
1 vote

entry.url forcing https

You could try and add the following condition to the .htaccess which should redirect everything to http, perhaps it'll work: RewriteCond %{HTTPS} off
Gįëł Tėttëłæår's user avatar
1 vote

entry.url forcing https

I got the link to work, but it seems like a dumb workaround. For some reason, http://example.com redirects to https://example.com when I use {{ entry.Url }}, but when I use http://www. the redirect ...
Jeff Fulton's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible