Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
content
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ok1kvk.cz
content
Commits
06589a19
Commit
06589a19
authored
5 years ago
by
Isabella Skořepová
Browse files
Options
Downloads
Patches
Plain Diff
Working redirect
parent
39250df3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sitegin/templates.js
+31
-14
31 additions, 14 deletions
sitegin/templates.js
theme-source/templates/redirect.js
+30
-0
30 additions, 0 deletions
theme-source/templates/redirect.js
with
61 additions
and
14 deletions
sitegin/templates.js
+
31
−
14
View file @
06589a19
...
...
@@ -10,26 +10,43 @@ const config = require('./config')
module
.
exports
=
async
(
data
,
type_
)
=>
{
try
{
// eslint-disable-next-line import/no-dynamic-require,global-require
const
T
emplate
=
require
(
path
.
join
(
const
t
emplate
s
=
require
(
path
.
join
(
process
.
cwd
(),
config
.
themeDir
,
'
templates
'
,
`
${
type_
}
.js`
,
)).
default
return
[
{
content
:
ReactDOM
.
renderToStaticMarkup
(
React
.
createElement
(
Template
,
{
...
data
,
config
:
{
...
data
.
config
,
baseurl
:
config
?
config
.
options
.
baseurl
:
''
,
},
}),
),
type
:
'
html
'
,
return
(
Array
.
isArray
(
templates
)
?
templates
:
[
templates
]).
map
(
Template
=>
{
const
props
=
{
...
data
,
config
:
{
...
data
.
config
,
baseurl
:
config
?
config
.
options
.
baseurl
:
''
,
},
}
if
(
'
type
'
in
Template
&&
Template
.
type
===
'
template
'
)
{
return
{
content
:
Template
.
value
(
props
),
type
:
Template
.
ext
||
'
html
'
,
}
}
if
(
'
type
'
in
Template
&&
Template
.
type
===
'
component
'
)
{
return
{
content
:
ReactDOM
.
renderToStaticMarkup
(
React
.
createElement
(
Template
,
props
),
),
type
:
Template
.
ext
||
'
html
'
,
}
}
return
{
content
:
ReactDOM
.
renderToStaticMarkup
(
React
.
createElement
(
Template
,
props
),
),
type
:
'
html
'
,
}
},
]
)
}
catch
(
e
)
{
// temporary until I implement all templates
if
(
e
.
code
===
'
MODULE_NOT_FOUND
'
)
return
[]
...
...
This diff is collapsed.
Click to expand it.
theme-source/templates/redirect.js
0 → 100644
+
30
−
0
View file @
06589a19
export
default
[
{
type
:
'
template
'
,
ext
:
'
php
'
,
value
:
({
config
,
content
})
=>
{
return
`<?php
header("HTTP/1.1 301 Moved Permanently");
header('location:
${
config
.
baseurl
}
/
${
content
}
');`
},
},
{
type
:
'
template
'
,
ext
:
'
html
'
,
value
:
({
config
,
content
})
=>
`<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1;url=
${
config
.
baseurl
}
/
${
content
}
">
<script type="text/javascript">
window.location.href = "
${
config
.
baseurl
}
/
${
content
}
"
</script>
<title>Přesměrování...</title>
</head>
<body>
Pokud nebudete přesměrováni automaticky tak následujte <a href='
${
config
.
baseurl
}
/
${
content
}
'>tento odkaz</a>
</body>
</html>
`
,
},
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment