I'm working on a laravel blade project and my site linked with 2 domains and I want to add noindex meta tag only on beta domain.
www.example.com don't add meta noindex tag
www.beta.example.com add meta noindex tag
Or I just need to add noindex meta tag and this will work automatically on beta domain and not work in actuall domain.
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<!--Here's the Meta noindex tag-->
<meta name="robots" content="noindex">
<script type='application/ld+json'>
{
"#context": "http:\/\/schema.org",
"#type": "WebSite",
"#id": "#website",
"url": "{{ route('home') }}",
"name": "{{ config('app.name', 'Know Before You Go') }}",
"alternateName": "Know Before You Go"
}
</script>
#if(isset($seo))
{{ $seo }}
#else
<title>{{ __("seo.homepage.title") }}</title>
#endif
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght#400;600;700&display=swap" rel="stylesheet">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=PT+Serif&display=swap" rel="stylesheet">
<!-- Styles -->
#vite('resources/css/app.css')
#livewireStyles
</head>
Thanks in advance
A better solution is actually to use Request::getHost();
#if (str_contains(Request::getHost(),'beta'))
<meta name="robots" content="noindex">
#endif
Related
To be honest, I'm having trouble understanding the concept of Laravel how to build in and use its assets (css, js). I guess I'm using a wrong but still working way even for production.
My approach for Production
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: [
'resources/css/app.css',
'resources/js/app.js',
],
refresh: true,
}),
],
});
Step 1: npm run build
Step 2: Manually copy the newly generated js and css files into my public folder.
Step 3: Change the file names in my bladetemplate. So app.11111.js to app.js
Note: This doesn't feel right but it worked for Production. I would be very grateful for any hints on this.
Here is my layout.blade.php file
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.bunny.net/css2?family=Nunito:wght#400;600;700&display=swap">
<link rel="stylesheet" href="{{ asset('assets/css/main.css') }}">
<!-- Scripts -->
#vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="font-sans antialiased">
<div class="min-h-screen bg-gray-100" style="min-height: 100vh; display:flex; flex-direction:column;">
#include('layouts.navigation')
<!-- Page Content -->
<main>
#yield('content')
</main>
#include('templateparts.footer')
</div>
<script src="{{ asset('assets/js/app.js') }}"></script>
</body>
</html>
I'm using Laravel 8 and trying to host my project to public localhost using php artisan serve --host '0.0.0.0' --port 8080 so I can access it from another device, but got the error message:
GET <ip>:8080/css/app.css net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
GET <ip>:8080/js/app.js net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)
I've used laravel mix and stored them in public/css and public/js. Here is my base laravel blade template code.
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{ asset('css/app.css') }}" rel="stylesheet" type="text/css">
<title>{{ config('app.name') }}</title>
</head>
<body>
#include('layouts.navbar')
#yield('content')
<script src="{{ asset('js/app.js') }}" defer></script>
</body>
</html>
I've also tried adding ASSET_URL=public in .env file, but still not working. Any help would be much appreciated, thank's in advanced!
I dont know what is going on with the routes of my Laravel 7 project.
When the route is simple, like "admin", "users" or anything like "xxxxxx", it works well.
But when I use the "/" for routes like "admin/", "admin/users", all the icons and images breaks.
I'm extending the views from the same blade layout.
Does anyone know what could it be?
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="{{ asset('/back/assets/img/poker-chip.png') }}">
title>Title | #yield('title')</title>
<link href="{{mix('back/assets/css/bootstrap.css')}}" rel="stylesheet">
<link href="back/assets/font-awesome/css/font-awesome.css" rel="stylesheet">
#stack('styles')
<link href="{{mix('back/assets/css/animate.css')}}" rel="stylesheet">
<link href="{{mix('back/assets/css/style.css')}}" rel="stylesheet">
</head>
<img alt="image" class="rounded-circle" src="back/assets/img/a7.jpg">
Exemple:
route 'admin', the image adress is http://localhost:8000/back/assets/img/a7.jpg. This is right!
route 'admin/', the image adress is http://localhost:8000/admin/back/assets/img/a7.jpg. This is wrong! There is an admin directory in the path that shouldn't be there.
try use concrete path instead of relative paths:
change:
<img alt="image" class="rounded-circle" src="back/assets/img/a7.jpg">
to:
<img alt="image" class="rounded-circle" src="/back/assets/img/a7.jpg">
Try changing a specific image from:
<img src="hello.jpg">
To
<img src="/hello.jpg">
Notice the / infront of the name. This should be the specific path to where the images are publicly store, examle: /images/source/hello.jpg
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">
I'm new to jekyll, I read the infos from their website and did the basic stuff and all worked ok. Now, I'm trying to learn more by doing a theme to it. The idea is I got a html template and I'm trying to make it to jekyll. The repo is at prologue-like-jekyll-theme.
I have a _config.yml with some info:
# Site settings
title: Personal Jekyll theme based on Prologue by HTML5 UP.
description: "Write your site description here."
baseurl: ""
url: ""
avatar: images/avatar.png
email: your-email#yourdomain.com
copyright_name: Your/Project/Corporate Name
I did a default.html layout:
<!DOCTYPE HTML>
<html>
<head>
<title>{{ site.title }}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="assets/css/main.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]-->
</head>
<body>
<!-- Header -->
{% include header.html %}
<!-- Main -->
<div id="main">
{{ content }}
</div>
<!-- Footer -->
{% include footer.html %}
</body>
</html>
I execute jekyll server, it runs but the site.title is not loading. The funny thing is if I change to site.time it works. Don't know why this is happen, any clue?
The _config.yml file is in _layouts folder, it should be in the root folder.