Hot answers tagged

8

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>


6

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 new window // from https://css-tricks.com/snippets/jquery/open-external-links-in-new-window/ - comment at end. function openAllExternalLinksInANewWindow() { $...


6

24 hours by default, but it can be configured via the defaultTokenDuration config setting. v2 documentation v3 documentation


4

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 something out. <li><a href="{% set usersByFirstName = craft.users.search('sortAS', '{{ firstName}}') %}">A-Z</a></li> The best way to ...


4

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 templates are set up. Content architecture and template decisions in Craft are custom from site to site and designed by the firm that created or maintains the ...


3

Pretty sure the invalidUserTokenPath config setting is what you're looking for.


2

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 field. https://imperavi.com/redactor/docs/settings/link/


2

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 field might exist on an install, grabbed its contents and verified them against the file system. Additionally, it would have to load any Rich Text field you ...


2

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.


2

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 first will lead to yoursite.com/google.com, the latter should work fine.


2

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 with all it's options and possible values. Please try {% for entry in craft.entries.section('orderBook').order('vendor').all() %} {% if entry.vendor.value ...


2

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: {{ entry.markdown|parseRefs|markdown }} Reference Tags support more than just entries, but this was the bit that I needed.


2

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 relations on a per-site basis. This will allow you to have different links for each of your sites, if you wish.


1

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="fields-website-isCpFormData" name="fields[website][isCpFormData]" value="true" type="hidden"> <input id="website" type="text" name="fields[website][url]">


1

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 plugin (e.g. A&M Nav) or in your Twig templates (in your master/layout template or some included template specific to the menu or nav).


1

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 entirely down to the developer to set up the fields and templates according to your needs. Do you have a text field specifically for entering the link? If there is ...


1

You could try and add the following condition to the .htaccess which should redirect everything to http, perhaps it'll work: RewriteCond %{HTTPS} off


1

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 doesn't occur. I changed my Site Url to www. and created a redirect to www. in the .htaccess file.


1

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 site while the tasks were stuck. Hard to know with 100% confidence, though.


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