Commit 39250df3 authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Fix few urls

parent 266ef468
......@@ -83,6 +83,15 @@ function dateFilter(date, format) {
return result
}
function relURL(filename, dir_) {
let dir = dir_
if (filename.substr(0, 1) === '/' || filename.match('://')) return filename
if (dir.substr(0, 1) !== '/') dir = `/${dir}`
if (filename.match(/\/$/)) return dir + filename
if (dir.match(/\/$/)) return dir + filename
return `${dir}/${filename}`
}
export function List({ subtags, tag, content, metadata, file, config }) {
return (
<div id="content" class="container">
......@@ -93,7 +102,7 @@ export function List({ subtags, tag, content, metadata, file, config }) {
{subtags &&
subtags.map(subtag => (
<a
href="{{ config.baseurl }}/{{ subtag.url }}"
href={`${config.baseurl}/${subtag.url}`}
class="chip"
key={subtag.url}
>
......@@ -106,19 +115,22 @@ export function List({ subtags, tag, content, metadata, file, config }) {
{content.map(page => (
<div class="col s12 m6 l4" key={page.file}>
<div class="block article">
<a href="{{ config.baseurl }}/{{ page.file }}">
<a href={`${config.baseurl}/${page.file}`}>
<div
style={{
height: 120,
backgroundImage: page.metadata.image
? `url('{{ config.baseurl }}{{ page.metadata.image | relURL(page.file) }}')`
? `url('${config.baseurl}${relURL(
page.metadata.image,
page.file,
)}')`
: undefined,
}}
className="leadimage light-blue darken-2"
></div>
</a>
<div class="head-title">
<a href="{{ config.baseurl }}/{{ page.file }}">
<a href={`${config.baseurl}/${page.file}`}>
<h5 class="center">{page.metadata.title}</h5>
</a>
</div>
......@@ -151,7 +163,7 @@ export function List({ subtags, tag, content, metadata, file, config }) {
display: 'inline-block',
width: '25%',
}}
href="{{ config.baseurl }}/{{ page.file }}"
href={`${config.baseurl}/${page.file}`}
>
Číst&nbsp;dál
</a>
......
......@@ -63,7 +63,7 @@ export function Paginator({ metadata, file, config }) {
</li>
) : (
<li class="waves-effect" key={page.pagenumber}>
<a href="{{ config.baseurl }}/{{ page.file }}">
<a href={`${config.baseurl}/${page.file}`}>
{page.metadata.pagenumber}
</a>
</li>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment