Publish Hardnerd image advertisement in article content
This commit is contained in:
parent
a5c5540b97
commit
f0a0f34d8b
8
config/advertising.php
Normal file
8
config/advertising.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'hn' => [
|
||||
'enabled' => env('HN_AD_ENABLED', true),
|
||||
'url' => env('HN_AD_URL', 'https://hardnerd.net/'),
|
||||
],
|
||||
];
|
||||
14
public/css/hn-article-ad.css
Normal file
14
public/css/hn-article-ad.css
Normal file
@ -0,0 +1,14 @@
|
||||
.hn-article-ad {
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
aspect-ratio: 2.45;
|
||||
margin: 20px 0;
|
||||
overflow: hidden;
|
||||
border: 1px solid #181b1e;
|
||||
border-radius: 12px;
|
||||
background: #181b1e;
|
||||
}
|
||||
.article-ad-group .hn-article-ad { margin: 0; }
|
||||
.hn-image-ad__link { position: absolute; inset: 0; display: block; }
|
||||
.hn-image-ad__link img { display: block; width: 100%; height: 100%; object-fit: cover; }
|
||||
.hn-image-ad__link:focus-visible { outline: 3px solid #b4f047; outline-offset: -4px; }
|
||||
BIN
public/images/ads/hn-ad-site-style-20261028.png
Normal file
BIN
public/images/ads/hn-ad-site-style-20261028.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
12
resources/views/components/hn-article-ad.blade.php
Normal file
12
resources/views/components/hn-article-ad.blade.php
Normal file
@ -0,0 +1,12 @@
|
||||
@if (config('advertising.hn.enabled') && config('advertising.hn.url') && is_file(public_path('images/ads/hn-ad-site-style-20261028.png')))
|
||||
@once
|
||||
@push('styles')
|
||||
<link rel="stylesheet" href="/css/hn-article-ad.css?v={{ filemtime(public_path('css/hn-article-ad.css')) }}">
|
||||
@endpush
|
||||
@endonce
|
||||
<aside class="hn-article-ad hn-image-ad" aria-label="HN 图片广告">
|
||||
<a class="hn-image-ad__link" href="{{ config('advertising.hn.url') }}" target="_blank" rel="sponsored noopener noreferrer" aria-label="广告:了解 Hardnerd 网络服务(新窗口打开)">
|
||||
<img src="/images/ads/hn-ad-site-style-20261028.png?v={{ filemtime(public_path('images/ads/hn-ad-site-style-20261028.png')) }}" alt="Hardnerd 广告:探索全球网络无限可能,了解 HN" width="1962" height="802">
|
||||
</a>
|
||||
</aside>
|
||||
@endif
|
||||
2
resources/views/pages/articles/default/show.blade.php
Executable file → Normal file
2
resources/views/pages/articles/default/show.blade.php
Executable file → Normal file
@ -77,6 +77,8 @@
|
||||
</div>
|
||||
|
||||
|
||||
@include('components.hn-article-ad')
|
||||
|
||||
<div class="post-tags mt-3 mt-md-4">
|
||||
<div class="">
|
||||
@foreach($oArticle->oTags as $oTag)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user