Open Graph and internationalization - alway's in english - asp.net

This is my first web site and i manage to make everything work except that.
I use ASP.Net and "Resources" files and then set the CurrentCulture which work's fine.
Now I want to share page of my website on Facebook. So i did use Open Graph tags.
I did try many combination of tags and i did try to rescrape in the Facebook Debugger but without succes. The retrieve description and title are ALWAY'S IN ENGLISH.
<meta property="og:locale:alternate" content="en_US" />
<meta property="og:locale:alternate" content="fr_FR" />
I also try to add:
<meta property="og:locale" content="fr_FR" />
Without success. I installed curl and run a "refresh" of facebook cache... still without success.
curl -X POST -F "id=http://facteurhumain.ca/facteur/lesNouvelles" -F "scrape=true" -F locale="fr_fr" "https://graph.facebook.com" -s
I did also try to put "en_US" and "fr_FR" in lower caps ("en_us", "fr_fr") without any changes.
Any pist of solution?
Thanks!!

Related

turbo drive works for a form but not a link

I an experimenting with turbo drive without rails.
It seems to work for forms but not links.. even when the form is set to GET.
To try to keep it minimal, I have used bash and cgi, but I saw the same thing using another web framework.
$ mkdir example
$ cd example
$ cat > index.html
<meta http-equiv="Refresh" content="0; url='/cgi-bin/index.sh'" />
$ mkdir cgi-bin
$ cat > cgi-bin/index.sh
#! /usr/bin/env bash
set -e
echo Content-Type: text/html
echo
sed "s/NEW/$RANDOM/g" << EOF
<html>
<head>
<title>DEMO</title>
<script src="/node_modules/#hotwired/turbo/dist/turbo.es2017-umd.js"></script>
</head>
<body>
<h1>DEMO</h1>
<h2>$QUERY_STRING</h2>
NEW
<form action="?">
<input type="hidden" name="val" value="NEW" />
<input type="submit" />
</form>
</body>
</html>
EOF
$ chmod +x cgi-bin/index.sh
$ npm install --save #hotwired/turbo#7.0.1
$ python3 -m http.server --cgi # or whichever server
then when I go to http://localhost:8000 I get this:
Both the both the link and the submit button load the random number displayed in the link, and prepare a new random number for loading.
The difference is that the link reloads the whole page as if turbo were not included, and the form fetches.
What do I have to do to make it ajax the link as well? Did I overlook an attribute I need in the link or something?
Stepping through the code I discovered this condition:
function isHTML(url) {
return !!getExtension(url).match(/^(?:|\.(?:htm|html|xhtml))$/);
}
So I renamed index.sh to index.html and it worked! I guess it probably works with no filename as well.
That restrictions only applies to links, not forms.

Styling Jekyll website with Bootstrap

I am trying to set up a website using Jekyll and GitHub Pages (first-timer), and most importantly, to style it with Bootstrap.
You can check what I have already done:
GitHub repository: https://github.com/thibaudclement/wallaby
GitHub page: http://thibaudclement.github.io/wallaby/ (check gh-pages branch)
Also, I followed this tutorial to import Bootstrap into the Jekyll structure.
Layouts and includes seem to work just fine, but I don't understand why my index.html does not get "styled" as it should, fetching information into the css/style.css file.
Any idea of what I am doing wrong?
Thanks.
The path to your css file is incorrect - it's not loading if you check your browser console
"Failed to load resource: the server responded with a status of 404 (Not Found) - http://thibaudclement.github.io/wallaby/style/site.css"
In _config.yml, you need to set baseurl: /wallaby.
And use {{ site.baseurl }} to load resources like this :
<link href="{{ site.baseurl }}/css/style.css" media="screen" rel="stylesheet" type="text/css" />.
See Jekyll documentation.

Resource interpreted as Script but transferred with MIME type text/x-c++

LESS beginner.
Wrote a test html below
<head>
<link rel="stylesheet" type="text/css" href="404.less">
<script src="http://lesscss.googlecode.com/files/less-1.3.0.min.js" type="text/javascript"></script>
</head>
<body>test</body>
But got a warning in Chrome
Resource interpreted as Script but transferred with MIME type text/x-c++: "http://lesscss.googlecode.com/files/less-1.3.0.min.js".
Why?
You probably want your link tag to say:
<link rel="stylesheet/less" type="text/css" href="404.less">
That said, if this is being served from a webserver it could be that that's detecting the mime type wrong from the file extension. If it's an apache server though, there's an easy fix. Add this to/create a .htaccess file in your webroot, containing the line:
AddType text/css less
I had a similar issue with twitter follow-me buttons when I was reviewing local html files in chrome. To fix this I just fired up web matrix 2.0 and pointed at my folder. Hope this helps.

Resource interpreted as stylesheet but transferred with MIME type text/html

This is my html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv = "Content-Language" content = "en"/>
<meta http-equiv = "Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/xxx/app/www/style.css">
Now when I load the page, Safari's inspector gives me:
Resource interpreted as stylesheet but transferred with MIME type text/html
I'm working on localhost with MAMP. I'm not sure what to modify to get this to work. I read that this might be a server problem of some kind.
How do I solve it?
Create an .htaccess file into your root folder (or update the existing one) with this line inside
AddType text/css .css
this will tell apache to send the right content-type header for .css file
There is possibility that not just css resources were interpreted wrongly. It maybe a problem of your webserver configuration.
The best way to check is to go to Chrome -> Network tab and check responses section for each request.
Also you can run $ curl -I http://path_to_file_or_page with terminal and have a look at response, you should see it in following format, e.g. Content-Type: image/jpeg
So, if it will occur that webserver (apache) does it for all filesthen you can try to solve the problem in following way:
Check your /etc/apache2/apache2.conf
If there are any SetHandler application/x-httpd-php line, try to comment it and then reload your apache by $ sudo system apache2 reload
Let us know if the problem is still there.
It could be that your web server is properly configured but it really is returning HTML instead of CSS.
Check that you have the correct path, spelling, case, etc. Hit the URL directly and see what comes back. Your web server might be responding with an error page (HTML) and a 200-Ok instead of a 404-Not Found.
I'm not saying this ever happened to me...

"Expires" in http header for static content? how-to

What is the best way to add "Expires" in http header for static content? eg. images, css, js
The web server is IIS 6.0; the language is classical ASP
You could try something like this:
#ECHO OFF
REM ---------------------------------------------------------------------------
REM Caching - sets the caching on static files in a web site
REM syntax
REM Caching.CMD 1 d:\sites\MySite\WWWRoot\*.CSS
REM
REM %1 is the WebSite ID
REM %2 is the path & Wildcard - for example, d:\sites\MySite\WWWRoot\*.CSS
REM _adsutil is the path to ADSUtil.VBS
REM ---------------------------------------------------------------------------
SETLOCAL
SET _adsutil=D:\Apps\Scripts\adsutil.vbs
FOR %%i IN (%2) DO (
ECHO Setting Caching on %%~ni%%~xi
CSCRIPT %_adsutil% CREATE W3SVC/%1/root/%%~ni%%~xi "IIsWebFile"
CSCRIPT %_adsutil% SET W3SVC/%1/root/%%~ni%%~xi/HttpExpires "D, 0x69780"
ECHO.
)
Which sets the caching value for each CSS file in a web root to 5 days, then run it like this:
Caching.CMD 1 \site\wwwroot\*.css
Caching.CMD 1 \site\wwwroot\*.js
Caching.CMD 1 \site\wwwroot\*.html
Caching.CMD 1 \site\wwwroot\*.htm
Caching.CMD 1 \site\wwwroot\*.gif
Caching.CMD 1 \site\wwwroot\*.jpg
Kind of painful, but workable.
BTW - to get the value for HttpExpires, set the value in the GUI, then run
AdsUtil.vbs ENUM W3SVC/1/root/File.txt
to get the actual value you need
I think this is what you're after, It's Content Expiration under HTTP Headers in IIS Manager. I use the pattern of sticking static content under a folder like ~/Resources and setting the expiration on that particular folder to have a much longer life than the rest of the application.
Here's a link to the full article: IIS 6.0 F1: Web Site Properties - HTTP Headers Tab
For others coming from google: this will not work in iis6 but works in 7 and above.
In your web.config:
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
in IIS admin you can set it for each file type or you can (for dynamic ones like aspx) do it in the code. After you have it setup you need to check the headers that are output with a tool like Mozilla firefox + live headers plugin - or you can use a web based tool like http://www.httpviewer.net/
I don't know if this is what you are looking for, but it does keep my pages from being cached.
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<META HTTP-EQUIV="Cache-Control" CONTENT="max-age=0">
I got these from an article on line that I no longer have a reference for.
Terrible solution, the first command to create with adsutil will fail with error -2147024713 (0x800700B7) since the files your trying to create already exists.
Thanks.

Resources