I have several links like this: hxxp://www.mydomain.com/visit/xxxxxxx
Is there a way to make them all nofollow using the /visit/ word?
I want to be able to do this to all the links that I have already, all together, not one by one.
Tks!!
you could do it this way
$actual_link = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
if (strpos($actual_link , '/visit/') !== FALSE)
print("<meta name=\"robots\" content=\"nofollow\" />");
Related
We have a rails app at remote.tools and if you see the product pages (see this page), there are a set of tags associated with each product. I am planning on having filtered search basis these tags on category pages (see this page). Now, I have already tried doing this with the 'Acts-as-taggable' gem and 'Simple-form' (basis this blog).
I am fine with having a page refresh on hitting 'search' or doing it in place (able to do both right now). However, I want to have unique URLs to be created basis the combination of filters applied by the user. For example, if the user selects 'Video communication tools' as the category and 'free trial' and 'easy-to-use' as the tags, the page URL should be '/video-communication-tools-with-free-trial-that-are-easy-to-use'. Currently, the filter options are passed as params i.e. '/search?category=xx&tags=yy'.
Having separate URLs for filter combinations will allow me create unique pages for indexing and add content contextually as well.
How should I go about doing this?
You can use jquery to achieve that,
Something like this.
<script>
$('#search_button').on('click', function(){
window.location = "" + $('#tag1').val()+"-"+$('#tag2').val();
});
</script>
Make sure to add id in your search button. Hope this works for you.
I'm looking for a way to truncate links displayed in my text.
Ie: <p><I want to share a link : http://www.itabc.org/wp-content/uploads/2013/10/Tools-for-Ruby-on-Rails-logo.jpg it rocks!</p>
Into : <p>I want to share a link : http://www.itabc.org/wp-con... it rocks!</p>
I want obviously to keep my href working.
Do you have any advice for me? I guess I need to create an helper.
EDIT:
The text ins't static in my views, I want to manage content posted by users in messages, so I have to find a way to truncate links automaticaly
thx
You can use the truncate helper:
= link_to truncate(text, length: 20), path
You can specify the number of characters and the omission (...), for example.
Edit
You need to combine what is suggested on this answers and the truncate method.
I have included the Google+ share url in my website (not the +1). However, it shares the entire page and not the specific article I want to link to. My article title has an anchor id, but when I add it to the share's url, it doesn't pick it up...
The logo of the page and a short description shows up, but it won't link to the specific article.
Any help would be greatly appreciated!
As far as I know, Google+ share button currently works only for whole pages and not sections.
The only way, though not very user friendly, is to split each content into single pages.
Anyone - pls correct me if I am wrong.
You will need to use the share button rather than the share URL to be able to share links with anchors. Even URL encoding the anchors results in them being stripped from the URL that is shared with the link. When using the button, specify the href value to include the particular anchor that you need.
Another approach if share link is a requirement....
Would be to implement on your site an alternate method for the anchors. For example, use http://mysite.com/?article=myarticleid where myarticleid is the same as the anchor and check for that on page load (source).
function getParameter(param) {
var val = document.URL;
var url = val.substr(val.indexOf(param))
var n=url.replace(param+"=","");
alert(n);
}
var anchor;
function checkForAnchor(){
anchor = getParameter("myarticle");
// Do something with anchor, see code examples below.
}
window.onload = checkForAnchor;
Then add some JavaScript at the end of that checkForAnchor() function that will scroll the page on load to the correct location or just jump to the anchor.
In jQuery, you might animate that effect like (source):
jQuery('html,body').animate({scrollTop: jQuery('#' + anchor).offset()}, 1000);
In standard JavaScript, you could simply change the location and append the anchor:
window.location = '#'+id;
I have a fairly long list of quick links (approx. 20) that I'm going to embed on my main page. Instead of adding the full url of each link to the each anchor, is there a way to add maybe the end of each link.
For instance, if the link to the url is
http://support.proboards.com/index.cgi?display&thread=423890
as you can see, my forum is a proboards forum if that helps anything here.
the location of each url is local,
Instead of adding the complete url, is there a way to use something like
<a href = "&thread=423890">
or maybe
<a href = "this.thread=423890"> ?
Not in pure HTML, the best you'll get is <a href="index.cgi?display&thread=423890">, which is what you should already be using. Of course I'm assuming support.proboards.com is your site here.
You could use JavaScript and call a function like openThread(423890) if you really wanted, but a)I wonder what you really gain from it, b)this won't work for people with JavaScript turned off (a la NoScript), and c)I wonder if Google would properly see all the links.
Presumably, these pages are all being generated by server-side script anyway, so you should only really be coding index.cgi?display&thread= once anyway...
If you're hard-set on doing something shorter, I'd suggest using URL rewriting. You can have a URL like .../display/thread/423890 and then use something shorter if you're already from a /display/thread/ page. But this requires the link to go to a page you have control over.
I'm an administrator for a wiki (using MediaWiki), and one of our sponsored links has requested that we add the rel="nofollow" attribute to their links, since they are trying to comply with a new google policy. I purposefully disabled the global rel="nofollow" for the entire wiki a while ago, and I want to keep it this way, so I just want to change this one link.
Now obviously it shouldn't be possible for a regular user to disable a rel="nofollow" attribute on a single link, since then spammers would do this and defeat the purpose of nofollow.
But I want to enable a rel="nofollow" attribute (and I'm also an administrator). Is there any way to do this?
For example, I can modify $wgNoFollowDomainExceptions if I want to remove a rel="nofollow" tag to all links to a certain domain. What I want is the opposite: to add a rel="nofollow" tag to all links to a certain domain.
thanks in advance!
PS. As far as I can tell, CSS and javascript hacks are no good, since this needs to be something that a search engine spider will see.
There is no configuration setting to do this. But you can easily enough do this using the LinkerMakeExternalLink hook. Add this to your LocalSettings.php:
function localAddNoFollow( &$url, &$text, &$link, &$attribs ) {
$bits = wfParseUrl( $url );
if ( is_array( $bits ) && isset( $bits['host'] ) ) {
if ( $bits['host'] == 'www.example.com' ) {
$attribs['rel']='nofollow';
}
}
return true;
}
$wgHooks['LinkerMakeExternalLink'][] = 'localAddNoFollow';