@tenjuu99/blog 0.2.39 → 0.2.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/pageData.js CHANGED
@@ -10,6 +10,15 @@ const parse = (content, name, ext) => {
10
10
  const regexp = new RegExp(/^(<!|-)--(?<variables>[\s\S]*?)--(-|>)/)
11
11
  const matched = content.match(regexp)
12
12
  const markdownReplaced = content.replace(regexp, '')
13
+ const fullUrl = (data) => {
14
+ const base = data.url_base + (data.relative_path ?? '')
15
+ let url = data.url
16
+ url = url.replace(/\/index$/, '/')
17
+ if (data.ext !== 'html') {
18
+ url = url + '.' + data.ext
19
+ }
20
+ return base + encodeURI(url)
21
+ }
13
22
  const metaDataDefault = Object.assign({
14
23
  name,
15
24
  title: name,
@@ -32,6 +41,7 @@ const parse = (content, name, ext) => {
32
41
  __filetype: ext,
33
42
  }, config)
34
43
  if (!matched) {
44
+ metaDataDefault.full_url = fullUrl(metaDataDefault)
35
45
  return metaDataDefault
36
46
  }
37
47
  const metaData = Object.fromEntries(
@@ -52,6 +62,7 @@ const parse = (content, name, ext) => {
52
62
  })
53
63
  )
54
64
  const metaDataMerged = Object.assign(metaDataDefault, metaData)
65
+ metaDataMerged.full_url = fullUrl(metaDataMerged)
55
66
  metaDataMerged['__output'] = name === 'index' ? '/index.html' : `${metaDataMerged.url}.${metaDataMerged.ext}`
56
67
 
57
68
  return metaDataMerged
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenjuu99/blog",
3
- "version": "0.2.39",
3
+ "version": "0.2.41",
4
4
  "description": "blog template",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -3,7 +3,7 @@
3
3
  flex-wrap: wrap;
4
4
  justify-content:flex-start;
5
5
  }
6
- .breadcrumbs-item {
6
+ .breadcrumbs-item:not(:first-child) {
7
7
  margin-left: 10px;
8
8
  }
9
9
  .breadcrumbs-item::after {
@@ -7,7 +7,7 @@
7
7
  {if noindex}
8
8
  <meta name="robots" content="noindex" />
9
9
  {/if}
10
- <meta property="og:url" content="{{URL_BASE}}{{URL}}">
10
+ <meta property="og:url" content="{{FULL_URL}}">
11
11
  <meta property="og:title" content="{{TITLE}}">
12
12
  {if og_image}
13
13
  <meta property="og:image" content="{{OG_IMAGE}}">
@@ -7,7 +7,7 @@
7
7
  {if noindex}
8
8
  <meta name="robots" content="noindex" />
9
9
  {/if}
10
- <meta property="og:url" content="{{URL_BASE}}{{URL}}">
10
+ <meta property="og:url" content="{{FULL_URL}}">
11
11
  <meta property="og:title" content="{{TITLE}}">
12
12
  {if og_image}
13
13
  <meta property="og:image" content="{{OG_IMAGE}}">