I want send description to page and if I don't send description use default from config file
in normal php I just write
<meta name="description" content="<?= if($replaceDescrption)?$replaceDescrption:$defaultDescrption">
how can I write this in laravel blade
<meta name="description" content="#if(yield('descrption'))?#yield('descrption'):{{config('app.description')}}">
I know I can send description with
#section('description',)
<meta name="description" content="replace des">
#endsection
put I need change in tow place
<meta property="og:description" content="#if(yield('descrption'))?#yield('descrption'):{{config('app.description')}}"/>
<meta name="description" content="#if(yield('descrption'))?#yield('descrption'):config('app.description')">
#yield takes default value for 2nd argument:
<meta property="og:description" content="#yield('description', config('app.description'))"/>
Related
I want to make a pdf invoice from blade template using Dompdf in Laravel 5.5.
The problem is when clicking on the download button the page is loading and after ~3 min i the pdf starts downloading.
Why is it taking so long?
the download link
<i class="fa fa-file-pdf-o"></i> Download Invoice
web route:
Route::get('/order/download-invoice/{OrderID}', 'Admin\AdminOrderController#downloadOrderInvoice')->name('admin.download-invoice');
a simple template (invoice.blade.php)
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other
head content must come *after* these tags -->
<title>Invoice</title>
<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}" media="screen">
</head>
<body>
<div>{{ $invoice->InvoiceTitle }} </div>
</body>
</html>
donwload invoice controller function:
use Barryvdh\DomPDF\Facade as PDF;
public function downloadOrderInvoice($OrderID){
$invoice = Invoice::where('OrderID', $OrderID)->first();
$pdf = PDF::loadView('invoice.invoice', compact('invoice'))->setPaper('a4', 'landscape');
return $pdf->download('invoice.pdf');
}
What i did wrong? Did i miss something?
UPDATE
clear the header and using EXTERNAL CDN bootstrap works.
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
Why is not using the local bootstrap using asset???
<link href="{{asset('css/bootstrap.min.css')}}" rel="stylesheet">
The image uploaded shows the post preview thumbnail of facebook.
(1)Consider a link x.com/abc which is redirected to y.com/xyz.
(2)When the link x.com/abc is shared on facebook it's preview is fetched from y.com/xyz.
(3)The preview thumbnail generated by facebook contains the domain y.com and not the x.com.
(4)How do we make the preview thumbnail show x.com and not the target url y.com.
The facebook screenshot show's that I shared url hivirality.com/abhishek which is redirected on citryxsolutions.in but the preview thumbnail contains the domain name of targeted url i.e citryxsolutions.in.
What are the possible cases to fix the issue.
You can do that, but it is a bit tricky. Instead of 301 redirect from x.com/abc to y.com/xyz. Your server should return HTML, which will redirect user through JS. This HTML should have Open Graph markup which Facebook is parsing. For example:
<!doctype html>
<html lang='en'>
<head>
<meta charset="utf-8" />
<meta property="og:url" content="URL" />
<meta property="og:title" content="TITLE" />
<meta property="og:type" content="website" />
<meta property="og:description" content="DESCRIPTION" />
<meta property="og:image" content="IMAGE URL" />
</head>
<body>
<script type="text/javascript">
if("false" == "false") {
window.location = "DESTINATION URL";
}
</script>
</body>
</html>
Where URL is x.com/abc
And DESTINATION URL is y.com/xyz
And you can check how Facebook reacts on that in FB debugger (also you can clear cache here): https://developers.facebook.com/tools/debug/
I am having trouble getting hot reloading to work with my laravel app.
//laravel homepage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
</head>
<body>
<div id="root"></div>
<?php
if (App::isLocal()):
?>
<script type="text/javascript" src="http://localhost:3000/static/bundle.js"></script>
<?php else: ?>
<script type="text/javascript" src="/dist/bundle.js"></script>
<?php endif; ?>
</body>
</html>
When I go to my homestead laravel backend page (localhost:8000), everything works fine, but there's no hot reloading when I change react components.
When I go directly to the dev-server http://localhost:3000 I get hot reloading.
I am using the react transform boilerplate: https://github.com/gaearon/react-transform-boilerplate
How can I get the backend laravel page to reload the bundle?
change
src="http://localhost:3000/static/bundle.js"
to
src="{{url('static/bundle.js)'}}"
and
src="/dist/bundle.js"
to
src="{{url('/dist/bundle.js')}}"
Recently, I have upgraded my project from Laravel 5.1 to Laravel 5.2 and I am facing a strange issue.
The emails I was sending in HTML format are not getting sent as plain text with html tags inside.
The email body and subject are configurable so I read them from database, replace the variable values and set them as a body and subject.
With Laravel 5.1 there was no issue with it. The code I am using to send email is as below:
Mail::send('layouts.email', $emailData, function($message) use ($emailData, $email_subject){
$message->to($emailData['to'], $emailData['name'])->subject($email_subject);
});
I also have tried,
Mail::send(['html' => 'layouts.email'], $emailData, function($message) use ($emailData, $email_subject){
$message->to($emailData['to'], $emailData['name'])->subject($email_subject);
});
The layout.email.blade.php template is as below:
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
{{$message_body}}
</body>
</html>
But the problem is still there. Can anybody guide me please?
Can anybody see whats wrong with this code, to say why this isnt validating using
https://dev.twitter.com/docs/cards/validation/validator
<meta name="twitter:card" content="product">
<meta name="twitter:site" content="#Agora_snapbacks">
<meta name="twitter:creator" content="#Agora_snapbacks">
<meta name="twitter:title" content="Agora Black Beanie">
<meta name="twitter:description" content="View our varied collection of beanies by Agora">
<meta name="twitter:image:src" content="http://agoraclothing.com/images/detailed/1/LOGOB_BLACK.JPG">
<meta name="twitter:data1" content="29.99">
<meta name="twitter:label1" content="Price">
<meta name="twitter:data2" content="United Kingdom">
<meta name="twitter:label2" content="Locaion">
http://agoraclothing.com/shop/hats/beanies/agora-black-beanie.html
Your issue may be in the price/data1 field. You may have to add the pound symbol before 29.99. I can't be positive but it's worth a try. --David