Hot answers tagged

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>
user avatar
  • 23.6k
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 ...
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
user avatar
  • 66.5k
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 ...
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 ...
user avatar
  • 13.3k
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.
user avatar
  • 66.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 ...
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 ...
user avatar
  • 66.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.
user avatar
  • 35.9k
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 ...
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 ...
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: {...
user avatar
  • 448
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 ...
user avatar
  • 3,604
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 ...
user avatar
  • 3,959
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 ...
user avatar
  • 66.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="...
user avatar
  • 608
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 ...
user avatar
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 ...
user avatar
  • 1,999
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
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 ...
user avatar
1 vote
Accepted

Corruption of Link to an Entry links within Rich Text field

It's entirely possible it was the stuck tasks depending on how the task originally failed, how many (and which ones) were backed up behind it and how many (and what kind of) changes were made on the ...
user avatar
  • 66.5k

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