Hreflang (Search Console) & arabic words in url - urlencode

I have a website with urls like this
htxp://ar.dzmeteo.com/أحوال-الطقس-في-أدرار
<link rel="alternate" href="htxp://ar.dzmeteo.com/أحوال-الطقس-في-أدرار" hreflang="ar" />
the problem is that in search console arabic urls are decoded, like this:
htxp://ar.dzmeteo.com/%D8%A3%D8%AD%D9%88%D8%A7%D9%84-%D8%A7%D9%84%D8%B7%D9%82%D8%B3-%D9%81%D9%8A-%D8%A3%D8%AF%D8%B1%D8%A7%D8%B1
and i get a lot of errors
errors in search console

Related

Linkedin Open Graph Sharing not working

I have a page setup for Open Graph Protocol because our app is built upon Angular 1.x now when we share a URL using LinkedIn. Share Popup opens but it does not crawl open graph tags sometimes and sometimes it shows the proper crawl tags it was working fine till last week. here is the image which shows the preview area:
Scenario for sharing a link:
User comes on our site: www.example.com/event/[EVENT_ID] and clicks share to LinkedIn.
Popups opens using: https://www.linkedin.com/shareArticle?mini=true&url=https://example.com/event/0u83s43rf6r/4295028179 where 4295028179 is event id and 0u83s43rf6r is a random key for sharing because of cache busting.
Now we are using apache mod_rewrite to redirect LinkedIn, Facebook, Twitter bot to our crawler page where Open graph tags are rendered.
Apache Mod Rewrite Settings in .htaccess file
RewriteCond %{HTTP_USER_AGENT} ^(facebookexternalhit/(.*)|Facebot|Twitter(.*)|Pinterest|LinkedIn(.*)|LinkedInBot)$ [NC]
RewriteRule ^(event)/([_0-9a-zA-Z]+)/([0-9]+)$ https://share.example.com/web/crawler/details/$3 [R=301,L]
So the end url becomes when crawler redirect based on USER AGENT where open graph tags are rendered: http://share.example.com/web/crwaler/details/4295028179
Here is the rendered html tags:
<html>
<head>
<script type="text/javascript">window.location = 'https://example.com/event/236129271' // if it's a browser then redirect it to website</script>
<meta property="og:title" content="Event Title" />
<meta property="og:description" content="Event Description" />
<meta property="og:image" content="Event Thumbnail" />
<meta name="title" content="LinkedIn Share Test" />
<meta name="description" content="Event Description" />
<meta property="og:image:width" content="188" />
<meta property="og:image:height" content="71" />
<!-- Twitter Card Working Fine-->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Event Title">
<meta name="twitter:description" content="Event Description">
<meta name="twitter:image" content="Event Image">
</head>
<body>
</body>
</html>
Last week this logic is working fine on Linkedin but now somehow it's not working.
Your code seems fine, you have the right og: tags, etc..
Whenever you're not sure that you're using the LinkedIn share API, check out your website with the LinkedIn Post Inspector, and this will tell you how the LinkedIn API is looking at your webpage. It covers many things, from <title> tags, to og: tags, to oEmbed tags, etc., etc..
Worried about caching? Why not test a URL like example.com?someFakeParameter=123? This will similarly bypass the caching at the LinkedIn Post Inspector.
If you could post your actual URL that you're sharing, I could give you a better answer, but hopefully something here helps!

replace favicon in mvc4

I have provided <link rel="shortcut icon" href="~/Images/logo.gif" /> in my layout but i wish to replace the favicon on all the pages, even where layout is not used.
I replaced the favicon file with my favicon (present in the root folder) still it loads the default favicon on pages without layout.
What more needs to be changed in order to get my favicon.
a similar but slightly different question has already been asked but isnt answered by anyone.link
It's better to convert your .gif to .ico, you can do this online
It's a convention to rename the icon to 'favicon.ico'
You can find more information on Wikipedia - look at the section 'How to use'
Your html should look like:
<link rel="shortcut icon" type="image/ico" href="~/Images/favicon.ico">
Check Mark Gravell's solution here

Google BOT visit and site languages

In my site, I have different languages in the same page, I mean, that if you select your lang, the the same file, show you the content in your language.
According to your browser language, my site load the content in that language, and in the HTML tags I add:
(In Spanish lang for example)
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="**es**" xml:lang="**es**">
for Google bot detect the language, but I have a problem. For example, in Google.es (Google Spain) the Google bot is indexing English content, I think that it is because, the google bot browser or config is in english.
I want to know how to tell to Google bot, that in Spain have to save spanish content, in Brazil, portugues content etc..
Thanks!
You need an own URL for each language version.
For users: You should offer an language switcher (link to all translations on each page), using hreflang attribute
For bots: You should link the translations of each page with <link rel="alternate" href="…" hreflang="es" /> (and so on)
If you site is example.com, and (nearly) all pages are translated, you could use the following URL design:
example.com/en/… (for English)
example.com/es/… (for Spanish)
…
If someone visits example.com/, you could redirect to the language version that is configured in the browser (but if someone visits a specific language version, don't redirect to another language!).

How to hide robot.txt from vistors?

I have seen sites hide the robot.txt file.
if you enter the name of the site as
http://www.mysite.com/robot.txt
you will not receive the robot.txt,
I also want to hide the file robot.txt from visitors how to do it?
Is there a connection of these lines
<meta name="ROBOTS" content="NOODP">
         <meta name="Slurp" content="NOYDIR">
So I do not understand the meaning of the code.
Thank you!
I'm not sure exactly what you're asking, but couldn't you do that with URL rewrites? You might be able to display the robots.txt file for visitors with the User Agent strings of a crawler (for instance, "Googlebot"), and then redirect to a 404 if it's a non-crawler UA

How can I get site's favicon using Selenium

I need to get web site's favicon.
How can I do that?
You won't be able to get the favicon with Selenium you would have to use another program to grab it. The only way you would be able to get it is if your website rendered the favicon.ico as a link such as
<link rel="shortcut icon"
href="http://example.com/myicon.ico" />
However typically websites just store the favicon.ico in the root directory and on page request the browser retrieves it and drops it in the address bar or tab or wherever favicons are used. If this is how your favicon is rendered then there will be no code or anything to search for with Selenium.
Also the above code while it does work has some buggy support for IE7.
You don't need Selenium.
Just request the site's home page and use an HTML parser to find a <link rel="shortcut icon" href="..."> tag.
If you don't find any such tag, try /favicon.ico.
Here is a bit crazy but working solution:
get the favicon image opened in a web page (and hence reachable with selenium) with the help of "http://www.google.com/s2/favicons". There are other services which provide a similar functionality, see:
Get website's favicon with JS
use cssneedle package to compare the resulting favicon with a pre-saved one
Needle is a tool for testing your CSS with Selenium and nose.
It checks that CSS renders correctly by taking screenshots of portions
of a website and comparing them against known good screenshots. It
also provides tools for testing calculated CSS values and the position
of HTML elements.
In other words, we are going to compare favicon images.
Example implementation (python):
from needle.cases import NeedleTestCase
class FavIconTestCase(NeedleTestCase):
def test_so(self):
self.driver.get('http://www.google.com/s2/favicons?domain=www.stackoverflow.com')
self.assertScreenshot('img', 'so-favicon')