Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
10940ca2
You need to sign in or sign up before continuing.
Commit
10940ca2
authored
Dec 24, 2018
by
Nicolas Giard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: seo meta + page titles
parent
fcee4c09
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
52 additions
and
26 deletions
+52
-26
admin-general.vue
client/components/admin/admin-general.vue
+0
-11
loader.vue
client/components/common/loader.vue
+2
-0
login.vue
client/components/login.vue
+2
-2
site-mutation-save-config.gql
client/graph/admin/site/site-mutation-save-config.gql
+0
-2
site-query-config.gql
client/graph/admin/site/site-query-config.gql
+0
-1
master.pug
dev/templates/master.pug
+13
-3
auth.js
server/controllers/auth.js
+3
-0
common.js
server/controllers/common.js
+12
-0
site.js
server/graph/resolvers/site.js
+0
-1
site.graphql
server/graph/schemas/site.graphql
+0
-2
master.js
server/master.js
+6
-0
seo.js
server/middlewares/seo.js
+1
-0
setup.js
server/setup.js
+0
-1
master.pug
server/views/master.pug
+13
-3
No files found.
client/components/admin/admin-general.vue
View file @
10940ca2
...
@@ -49,15 +49,6 @@
...
@@ -49,15 +49,6 @@
v-model='config.description'
v-model='config.description'
prepend-icon='explore'
prepend-icon='explore'
)
)
v-text-field(
outline
label='Site Keywords'
:counter='255'
v-model='config.keywords'
prepend-icon='explore'
hint='Comma-separated list of keywords.'
persistent-hint
)
v-select.mt-2(
v-select.mt-2(
outline
outline
label='Meta Robots'
label='Meta Robots'
...
@@ -170,7 +161,6 @@ export default {
...
@@ -170,7 +161,6 @@ export default {
host
:
''
,
host
:
''
,
title
:
''
,
title
:
''
,
description
:
''
,
description
:
''
,
keywords
:
''
,
robots
:
[],
robots
:
[],
ga
:
''
,
ga
:
''
,
company
:
''
,
company
:
''
,
...
@@ -196,7 +186,6 @@ export default {
...
@@ -196,7 +186,6 @@ export default {
host
:
this
.
config
.
host
||
''
,
host
:
this
.
config
.
host
||
''
,
title
:
this
.
config
.
title
||
''
,
title
:
this
.
config
.
title
||
''
,
description
:
this
.
config
.
description
||
''
,
description
:
this
.
config
.
description
||
''
,
keywords
:
this
.
config
.
keywords
||
''
,
robots
:
this
.
config
.
robots
||
[],
robots
:
this
.
config
.
robots
||
[],
ga
:
this
.
config
.
ga
||
''
,
ga
:
this
.
config
.
ga
||
''
,
company
:
this
.
config
.
company
||
''
,
company
:
this
.
config
.
company
||
''
,
...
...
client/components/common/loader.vue
View file @
10940ca2
...
@@ -51,6 +51,8 @@ export default {
...
@@ -51,6 +51,8 @@ export default {
<
style
lang=
'scss'
>
<
style
lang=
'scss'
>
.loader-dialog
{
.loader-dialog
{
transition
:
all
.4s
ease
;
.atom-spinner.is-inline
{
.atom-spinner.is-inline
{
display
:
inline-block
;
display
:
inline-block
;
}
}
...
...
client/components/login.vue
View file @
10940ca2
...
@@ -350,10 +350,10 @@ export default {
...
@@ -350,10 +350,10 @@ export default {
@
include
keyframes
(
loginBgReveal
)
{
@
include
keyframes
(
loginBgReveal
)
{
0
%
{
0
%
{
background
-
position
-
y
:
0
;
background
-
position
-
x
:
0
;
}
}
100
%
{
100
%
{
background
-
position
-
y
:
-
800
px
;
background
-
position
-
x
:
800
px
;
}
}
}
}
...
...
client/graph/admin/site/site-mutation-save-config.gql
View file @
10940ca2
...
@@ -2,7 +2,6 @@ mutation (
...
@@ -2,7 +2,6 @@ mutation (
$host
:
String
!
$host
:
String
!
$title
:
String
!
$title
:
String
!
$description
:
String
!
$description
:
String
!
$keywords
:
String
!
$robots
:
[
String
]!
$robots
:
[
String
]!
$ga
:
String
!
$ga
:
String
!
$company
:
String
!
$company
:
String
!
...
@@ -17,7 +16,6 @@ mutation (
...
@@ -17,7 +16,6 @@ mutation (
host
:
$host
,
host
:
$host
,
title
:
$title
,
title
:
$title
,
description
:
$description
,
description
:
$description
,
keywords
:
$keywords
,
robots
:
$robots
,
robots
:
$robots
,
ga
:
$ga
,
ga
:
$ga
,
company
:
$company
,
company
:
$company
,
...
...
client/graph/admin/site/site-query-config.gql
View file @
10940ca2
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
host
host
title
title
description
description
keywords
robots
robots
ga
ga
company
company
...
...
dev/templates/master.pug
View file @
10940ca2
...
@@ -7,7 +7,17 @@ html
...
@@ -7,7 +7,17 @@ html
meta(name='theme-color', content='#333333')
meta(name='theme-color', content='#333333')
meta(name='msapplication-TileColor', content='#333333')
meta(name='msapplication-TileColor', content='#333333')
meta(name='msapplication-TileImage', content='/favicons/ms-icon-144x144.png')
meta(name='msapplication-TileImage', content='/favicons/ms-icon-144x144.png')
title= config.title
title= pageMeta.title + ' | ' + config.title
//- SEO / OpenGraph
meta(name='description', content=pageMeta.description)
meta(property='og:title', content=pageMeta.title)
meta(property='og:type', content='website')
meta(property='og:description', content=pageMeta.description)
meta(property='og:image', content=pageMeta.image)
meta(property='og:url', content=pageMeta.url)
meta(property='og:site_name', content=config.title)
//- Favicon
//- Favicon
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180]
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180]
...
@@ -17,9 +27,9 @@ html
...
@@ -17,9 +27,9 @@ html
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href='/manifest.json')
link(rel='manifest', href='/manifest.json')
//- Site
Lang
//- Site
Properties
script.
script.
var siteConfig = !{JSON.stringify({ title: config.title, theme: config.theming.theme, darkMode: config.theming.darkMode, lang: config.lang.code })}
var siteConfig = !{JSON.stringify({ title: config.title, theme: config.theming.theme, darkMode: config.theming.darkMode, lang: config.lang.code
, company: config.company
})}
//- CSS
//- CSS
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Varela+Round|Source+Code+Pro:400,700|Material+Icons')
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Varela+Round|Source+Code+Pro:400,700|Material+Icons')
...
...
server/controllers/auth.js
View file @
10940ca2
...
@@ -3,11 +3,13 @@
...
@@ -3,11 +3,13 @@
const
express
=
require
(
'express'
)
const
express
=
require
(
'express'
)
const
router
=
express
.
Router
()
const
router
=
express
.
Router
()
const
moment
=
require
(
'moment'
)
const
moment
=
require
(
'moment'
)
const
_
=
require
(
'lodash'
)
/**
/**
* Login form
* Login form
*/
*/
router
.
get
(
'/login'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'/login'
,
function
(
req
,
res
,
next
)
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'Login'
)
res
.
render
(
'login'
)
res
.
render
(
'login'
)
})
})
...
@@ -23,6 +25,7 @@ router.get('/logout', function (req, res) {
...
@@ -23,6 +25,7 @@ router.get('/logout', function (req, res) {
* Register form
* Register form
*/
*/
router
.
get
(
'/register'
,
async
(
req
,
res
,
next
)
=>
{
router
.
get
(
'/register'
,
async
(
req
,
res
,
next
)
=>
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'Register'
)
const
localStrg
=
await
WIKI
.
models
.
authentication
.
getStrategy
(
'local'
)
const
localStrg
=
await
WIKI
.
models
.
authentication
.
getStrategy
(
'local'
)
if
(
localStrg
.
selfRegistration
)
{
if
(
localStrg
.
selfRegistration
)
{
res
.
render
(
'register'
)
res
.
render
(
'register'
)
...
...
server/controllers/common.js
View file @
10940ca2
const
express
=
require
(
'express'
)
const
express
=
require
(
'express'
)
const
router
=
express
.
Router
()
const
router
=
express
.
Router
()
const
pageHelper
=
require
(
'../helpers/page'
)
const
pageHelper
=
require
(
'../helpers/page'
)
const
_
=
require
(
'lodash'
)
/* global WIKI */
/* global WIKI */
...
@@ -16,10 +17,13 @@ router.get(['/e', '/e/*'], async (req, res, next) => {
...
@@ -16,10 +17,13 @@ router.get(['/e', '/e/*'], async (req, res, next) => {
isPrivate
:
false
isPrivate
:
false
})
})
if
(
page
)
{
if
(
page
)
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
`Edit
${
page
.
title
}
`
)
_
.
set
(
res
.
locals
,
'pageMeta.description'
,
page
.
description
)
page
.
mode
=
'update'
page
.
mode
=
'update'
page
.
isPublished
=
(
page
.
isPublished
===
true
||
page
.
isPublished
===
1
)
?
'true'
:
'false'
page
.
isPublished
=
(
page
.
isPublished
===
true
||
page
.
isPublished
===
1
)
?
'true'
:
'false'
page
.
content
=
Buffer
.
from
(
page
.
content
).
toString
(
'base64'
)
page
.
content
=
Buffer
.
from
(
page
.
content
).
toString
(
'base64'
)
}
else
{
}
else
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
`New Page`
)
page
=
{
page
=
{
path
:
pageArgs
.
path
,
path
:
pageArgs
.
path
,
localeCode
:
pageArgs
.
locale
,
localeCode
:
pageArgs
.
locale
,
...
@@ -35,6 +39,7 @@ router.get(['/e', '/e/*'], async (req, res, next) => {
...
@@ -35,6 +39,7 @@ router.get(['/e', '/e/*'], async (req, res, next) => {
* Administration
* Administration
*/
*/
router
.
get
([
'/a'
,
'/a/*'
],
(
req
,
res
,
next
)
=>
{
router
.
get
([
'/a'
,
'/a/*'
],
(
req
,
res
,
next
)
=>
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'Admin'
)
res
.
render
(
'admin'
)
res
.
render
(
'admin'
)
})
})
...
@@ -42,6 +47,7 @@ router.get(['/a', '/a/*'], (req, res, next) => {
...
@@ -42,6 +47,7 @@ router.get(['/a', '/a/*'], (req, res, next) => {
* Profile
* Profile
*/
*/
router
.
get
([
'/p'
,
'/p/*'
],
(
req
,
res
,
next
)
=>
{
router
.
get
([
'/p'
,
'/p/*'
],
(
req
,
res
,
next
)
=>
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'User Profile'
)
res
.
render
(
'profile'
)
res
.
render
(
'profile'
)
})
})
...
@@ -57,6 +63,8 @@ router.get(['/h', '/h/*'], async (req, res, next) => {
...
@@ -57,6 +63,8 @@ router.get(['/h', '/h/*'], async (req, res, next) => {
isPrivate
:
false
isPrivate
:
false
})
})
if
(
page
)
{
if
(
page
)
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
page
.
title
)
_
.
set
(
res
.
locals
,
'pageMeta.description'
,
page
.
description
)
res
.
render
(
'history'
,
{
page
})
res
.
render
(
'history'
,
{
page
})
}
else
{
}
else
{
res
.
redirect
(
`/
${
pageArgs
.
path
}
`
)
res
.
redirect
(
`/
${
pageArgs
.
path
}
`
)
...
@@ -75,6 +83,8 @@ router.get(['/s', '/s/*'], async (req, res, next) => {
...
@@ -75,6 +83,8 @@ router.get(['/s', '/s/*'], async (req, res, next) => {
isPrivate
:
false
isPrivate
:
false
})
})
if
(
page
)
{
if
(
page
)
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
page
.
title
)
_
.
set
(
res
.
locals
,
'pageMeta.description'
,
page
.
description
)
res
.
render
(
'source'
,
{
page
})
res
.
render
(
'source'
,
{
page
})
}
else
{
}
else
{
res
.
redirect
(
`/
${
pageArgs
.
path
}
`
)
res
.
redirect
(
`/
${
pageArgs
.
path
}
`
)
...
@@ -93,6 +103,8 @@ router.get('/*', async (req, res, next) => {
...
@@ -93,6 +103,8 @@ router.get('/*', async (req, res, next) => {
isPrivate
:
false
isPrivate
:
false
})
})
if
(
page
)
{
if
(
page
)
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
page
.
title
)
_
.
set
(
res
.
locals
,
'pageMeta.description'
,
page
.
description
)
const
sidebar
=
await
WIKI
.
models
.
navigation
.
getTree
({
cache
:
true
})
const
sidebar
=
await
WIKI
.
models
.
navigation
.
getTree
({
cache
:
true
})
res
.
render
(
'page'
,
{
page
,
sidebar
})
res
.
render
(
'page'
,
{
page
,
sidebar
})
}
else
if
(
pageArgs
.
path
===
'home'
)
{
}
else
if
(
pageArgs
.
path
===
'home'
)
{
...
...
server/graph/resolvers/site.js
View file @
10940ca2
...
@@ -30,7 +30,6 @@ module.exports = {
...
@@ -30,7 +30,6 @@ module.exports = {
WIKI
.
config
.
company
=
args
.
company
WIKI
.
config
.
company
=
args
.
company
WIKI
.
config
.
seo
=
{
WIKI
.
config
.
seo
=
{
description
:
args
.
description
,
description
:
args
.
description
,
keywords
:
args
.
keywords
,
robots
:
args
.
robots
,
robots
:
args
.
robots
,
ga
:
args
.
ga
ga
:
args
.
ga
}
}
...
...
server/graph/schemas/site.graphql
View file @
10940ca2
...
@@ -27,7 +27,6 @@ type SiteMutation {
...
@@ -27,7 +27,6 @@ type SiteMutation {
host
:
String
!
host
:
String
!
title
:
String
!
title
:
String
!
description
:
String
!
description
:
String
!
keywords
:
String
!
robots
:
[
String
]!
robots
:
[
String
]!
ga
:
String
!
ga
:
String
!
company
:
String
!
company
:
String
!
...
@@ -47,7 +46,6 @@ type SiteConfig {
...
@@ -47,7 +46,6 @@ type SiteConfig {
host
:
String
!
host
:
String
!
title
:
String
!
title
:
String
!
description
:
String
!
description
:
String
!
keywords
:
String
!
robots
:
[
String
]!
robots
:
[
String
]!
ga
:
String
!
ga
:
String
!
company
:
String
!
company
:
String
!
...
...
server/master.js
View file @
10940ca2
...
@@ -100,6 +100,12 @@ module.exports = async () => {
...
@@ -100,6 +100,12 @@ module.exports = async () => {
app
.
locals
.
moment
=
require
(
'moment'
)
app
.
locals
.
moment
=
require
(
'moment'
)
app
.
locals
.
moment
.
locale
(
WIKI
.
config
.
lang
.
code
)
app
.
locals
.
moment
.
locale
(
WIKI
.
config
.
lang
.
code
)
app
.
locals
.
config
=
WIKI
.
config
app
.
locals
.
config
=
WIKI
.
config
app
.
locals
.
pageMeta
=
{
title
:
''
,
description
:
WIKI
.
config
.
description
,
image
:
''
,
url
:
'/'
}
// ----------------------------------------
// ----------------------------------------
// HMR (Dev Mode Only)
// HMR (Dev Mode Only)
...
...
server/middlewares/seo.js
View file @
10940ca2
...
@@ -15,6 +15,7 @@ module.exports = function (req, res, next) {
...
@@ -15,6 +15,7 @@ module.exports = function (req, res, next) {
let
query
=
req
.
url
.
slice
(
req
.
path
.
length
)
||
''
let
query
=
req
.
url
.
slice
(
req
.
path
.
length
)
||
''
res
.
redirect
(
301
,
req
.
path
.
slice
(
0
,
-
1
)
+
query
)
res
.
redirect
(
301
,
req
.
path
.
slice
(
0
,
-
1
)
+
query
)
}
else
{
}
else
{
_
.
set
(
res
.
locals
,
'pageMeta.url'
,
`
${
WIKI
.
config
.
host
}${
req
.
path
}
`
)
return
next
()
return
next
()
}
}
}
}
server/setup.js
View file @
10940ca2
...
@@ -133,7 +133,6 @@ module.exports = () => {
...
@@ -133,7 +133,6 @@ module.exports = () => {
_
.
set
(
WIKI
.
config
,
'public'
,
false
)
_
.
set
(
WIKI
.
config
,
'public'
,
false
)
_
.
set
(
WIKI
.
config
,
'seo'
,
{
_
.
set
(
WIKI
.
config
,
'seo'
,
{
description
:
''
,
description
:
''
,
keywords
:
''
,
robots
:
[
'index'
,
'follow'
],
robots
:
[
'index'
,
'follow'
],
ga
:
''
ga
:
''
})
})
...
...
server/views/master.pug
View file @
10940ca2
...
@@ -7,7 +7,17 @@ html
...
@@ -7,7 +7,17 @@ html
meta(name='theme-color', content='#333333')
meta(name='theme-color', content='#333333')
meta(name='msapplication-TileColor', content='#333333')
meta(name='msapplication-TileColor', content='#333333')
meta(name='msapplication-TileImage', content='/favicons/ms-icon-144x144.png')
meta(name='msapplication-TileImage', content='/favicons/ms-icon-144x144.png')
title= config.title
title= pageMeta.title + ' | ' + config.title
//- SEO / OpenGraph
meta(name='description', content=pageMeta.description)
meta(property='og:title', content=pageMeta.title)
meta(property='og:type', content='website')
meta(property='og:description', content=pageMeta.description)
meta(property='og:image', content=pageMeta.image)
meta(property='og:url', content=pageMeta.url)
meta(property='og:site_name', content=config.title)
//- Favicon
//- Favicon
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180]
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180]
...
@@ -17,9 +27,9 @@ html
...
@@ -17,9 +27,9 @@ html
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href='/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href='/manifest.json')
link(rel='manifest', href='/manifest.json')
//- Site
Lang
//- Site
Properties
script.
script.
var siteConfig = !{JSON.stringify({ title: config.title, theme: config.theming.theme, darkMode: config.theming.darkMode, lang: config.lang.code })}
var siteConfig = !{JSON.stringify({ title: config.title, theme: config.theming.theme, darkMode: config.theming.darkMode, lang: config.lang.code
, company: config.company
})}
//- CSS
//- CSS
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Varela+Round|Source+Code+Pro:400,700|Material+Icons')
link(type='text/css', rel='stylesheet', href='https://fonts.googleapis.com/icon?family=Roboto:400,500,700|Varela+Round|Source+Code+Pro:400,700|Material+Icons')
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment