Skip to content

Commit 95aad54

Browse files
committed
Fix Amazon link
1 parent 8516c8a commit 95aad54

6 files changed

Lines changed: 62 additions & 58 deletions

File tree

assets/css/custom.css

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.amazon-widget {
2+
margin: 2rem 0;
3+
max-width: 480px;
4+
position: relative;
5+
}
6+
.amazon-widget a {
7+
position: absolute;
8+
top: 0;
9+
left: 0;
10+
height: 100%;
11+
width: 100%;
12+
box-shadow: none;
13+
}
14+
.amazon-widget-img {
15+
border: 1px solid var(--border);
16+
border-radius: var(--radius);
17+
text-align: center;
18+
}
19+
.amazon-widget-img img {
20+
border: none;
21+
margin: 0 auto;
22+
max-height: 200px;
23+
padding: 16px;
24+
}
25+
.amazon-widget-info {
26+
border-right: 1px solid var(--border);
27+
border-bottom: 1px solid var(--border);
28+
border-left: 1px solid var(--border);
29+
border-radius: var(--radius);
30+
padding: 5px 10px 10px 10px;
31+
}
32+
.amazon-widget:hover .amazon-widget-info {
33+
background-color: var(--code-bg);
34+
}
35+
.amazon-widget-title {
36+
display: block;
37+
}
38+
.amazon-widget-via {
39+
color: var(--secondary);
40+
font-size: 14px;
41+
}
42+
.amazon-widget-via img {
43+
border: none;
44+
width: 18px;
45+
height: 18px;
46+
margin: 0;
47+
padding: 0;
48+
display: inline;
49+
vertical-align: text-bottom;
50+
}

assets/scss/custom.scss

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -17,59 +17,3 @@ a.btn-bmc {
1717
background-color: darken(rgb(112, 189, 252), 2%);
1818
}
1919
}
20-
21-
.amazon-widget {
22-
margin: 2rem 0;
23-
max-width: 480px;
24-
position: relative;
25-
26-
a {
27-
position: absolute;
28-
top: 0;
29-
left: 0;
30-
height: 100%;
31-
width: 100%;
32-
}
33-
}
34-
35-
.amazon-widget-img {
36-
border: 1px solid #E1E8ED;
37-
border-radius: 15px 15px 0 0;
38-
text-align: center;
39-
40-
img {
41-
border: none;
42-
margin: 0 auto;
43-
max-height: 200px;
44-
padding: 16px;
45-
}
46-
}
47-
.amazon-widget-info {
48-
border-right: 1px solid #E1E8ED;
49-
border-bottom: 1px solid #E1E8ED;
50-
border-left: 1px solid #E1E8ED;
51-
padding: 5px 10px 10px 10px;
52-
border-radius: 0 0 15px 15px;
53-
}
54-
.amazon-widget:hover .amazon-widget-info {
55-
background-color: #E1E8ED;
56-
}
57-
58-
.amazon-widget-title {
59-
font-weight: bold;
60-
display: block;
61-
}
62-
63-
.amazon-widget-via {
64-
color: #aaa;
65-
66-
img {
67-
border: none;
68-
width: 18px;
69-
height: 18px;
70-
margin: 0;
71-
padding: 0;
72-
display: inline;
73-
vertical-align: text-bottom;
74-
}
75-
}

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
github.com/HugoBlox/hugo-blox-builder/modules/blox-analytics v0.1.3/go.mod h1:0YQtVvRLCzZOpPmbVNk7WDx8t19/QfRTFO+pwyqQNk8=
2+
github.com/HugoBlox/hugo-blox-builder/modules/blox-analytics v0.2.0/go.mod h1:0YQtVvRLCzZOpPmbVNk7WDx8t19/QfRTFO+pwyqQNk8=
23
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.1 h1:qlDCZWq7OhuwLr7/rDPXe8iGxam2t1kgLabZ9EP0VqM=
34
github.com/HugoBlox/hugo-blox-builder/modules/blox-plugin-netlify v1.1.1/go.mod h1:C7jfxMLv1bEUqbM9XDSmEpfOpS8w06OgqNDEcbuRgL4=
45
github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.4.2 h1:Y/PQ9bGbbM3iDzYSp5un2Fg6ge8/4VVEhTkN0sY2qdY=
56
github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.4.2/go.mod h1:bUQKSt1XQhk60nSpI6D+MibQi6v8s7HghF5qoAtlhws=
7+
github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.5.2 h1:vqXNdxb+5LxRupFjgfJgjsW7SvV0ui6PZwreQuE/jOM=
8+
github.com/HugoBlox/hugo-blox-builder/modules/blox-tailwind v0.5.2/go.mod h1:iiKLoehg9IqQd0R4jUfhl+wvJCiXPNgV88A/V8iKSLY=

layouts/shortcodes/amazon.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{{- $tag := site.Params.amazonJpAffiliate }}
22
{{- $asin := .Get "asin" -}}
33
{{- $title := .Get "title" -}}
4+
{{- $destination := "no_image_square.jpg" -}}
5+
{{- $img := (.Page.Resources.ByType "image").GetMatch $destination -}}
6+
{{- if not $img -}}
7+
{{- $img = resources.Get (path.Join "media" $destination) -}}
8+
{{- end -}}
49
<div class="amazon-widget">
510
<a target="_blank" href="https://www.amazon.co.jp/gp/product/{{ $asin }}/?tag={{ $tag }}"></a>
611
<div class="amazon-widget-img">
7-
<img src="//ws-fe.amazon-adsystem.com/widgets/q?_encoding=UTF8&MarketPlace=JP&ASIN={{ $asin }}&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL350_&tag={{ $tag }}" />
12+
<img src="{{ $img }}" />
813
</div>
914
<div class="amazon-widget-info">
1015
<span class="amazon-widget-title">

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
"build": "hugo --minify"
1010
},
1111
"dependencies": {
12+
"@tailwindcss/typography": "^0.5.10"
13+
},
14+
"devDependencies": {
1215
"@tailwindcss/cli": "^4.1.12",
13-
"@tailwindcss/typography": "^0.5.10",
1416
"tailwindcss": "^4.1.12"
1517
}
1618
}

static/media/no_image_square.jpg

23.8 KB
Loading

0 commit comments

Comments
 (0)