deleting unused dependencies, better explaining 301 post
This commit is contained in:
parent
3ab76110ee
commit
6b0b2ab157
3 changed files with 11 additions and 59 deletions
41
package-lock.json
generated
41
package-lock.json
generated
|
|
@ -18,7 +18,6 @@
|
|||
"devDependencies": {
|
||||
"@netlify/plugin-a11y": "^1.0.0-beta.1",
|
||||
"@toycode/markdown-it-class": "^1.2.4",
|
||||
"artificial-chart": "^2.0.3",
|
||||
"clean-css": "^5.3.1",
|
||||
"concurrently": "^7.4.0",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
@ -31,7 +30,6 @@
|
|||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"glob": "^8.0.3",
|
||||
"html-minifier": "^4.0.0",
|
||||
"lite-youtube-embed": "^0.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^13.0.1",
|
||||
"markdown-it-abbr": "^1.0.4",
|
||||
|
|
@ -53,8 +51,7 @@
|
|||
"prettier": "^2.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"sanitize-html": "^2.7.2",
|
||||
"slugify": "^1.6.5",
|
||||
"speedlify-score": "^2.0.2"
|
||||
"slugify": "^1.6.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "16.x"
|
||||
|
|
@ -657,12 +654,6 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/artificial-chart": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/artificial-chart/-/artificial-chart-2.0.3.tgz",
|
||||
"integrity": "sha512-14/cyhERovLs2+2UoObESKuYNfD8dOmQWoxEMc2O4yxJaKz9l72AeH9fNq8B0d0LN6yQOlEoIcp45p/HjWHxaw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/asap": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||
|
|
@ -3593,12 +3584,6 @@
|
|||
"resolved": "https://registry.npmjs.org/list-to-array/-/list-to-array-1.1.0.tgz",
|
||||
"integrity": "sha512-+dAZZ2mM+/m+vY9ezfoueVvrgnHIGi5FvgSymbIgJOFwiznWyA59mav95L+Mc6xPtL3s9gm5eNTlNtxJLbNM1g=="
|
||||
},
|
||||
"node_modules/lite-youtube-embed": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/lite-youtube-embed/-/lite-youtube-embed-0.2.0.tgz",
|
||||
"integrity": "sha512-XXXAk5sbvtjjwbie3XG+6HppgTm1HTGL/Uk9z9NkJH53o7puZLur434heHzAjkS60hZB3vT4ls25zl5rMiX4EA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/load-json-file": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
||||
|
|
@ -6311,12 +6296,6 @@
|
|||
"integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/speedlify-score": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/speedlify-score/-/speedlify-score-2.0.2.tgz",
|
||||
"integrity": "sha512-FAFunl3H/faGETUX0tMh/fU0CZs5afqPR6Qm3I8xPVo9iLOZVhiDA6pUm5owXq4rSEb45y3Pf8iJqE6DmZiNvA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
|
|
@ -7524,12 +7503,6 @@
|
|||
"resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz",
|
||||
"integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug=="
|
||||
},
|
||||
"artificial-chart": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/artificial-chart/-/artificial-chart-2.0.3.tgz",
|
||||
"integrity": "sha512-14/cyhERovLs2+2UoObESKuYNfD8dOmQWoxEMc2O4yxJaKz9l72AeH9fNq8B0d0LN6yQOlEoIcp45p/HjWHxaw==",
|
||||
"dev": true
|
||||
},
|
||||
"asap": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||
|
|
@ -9554,12 +9527,6 @@
|
|||
"resolved": "https://registry.npmjs.org/list-to-array/-/list-to-array-1.1.0.tgz",
|
||||
"integrity": "sha512-+dAZZ2mM+/m+vY9ezfoueVvrgnHIGi5FvgSymbIgJOFwiznWyA59mav95L+Mc6xPtL3s9gm5eNTlNtxJLbNM1g=="
|
||||
},
|
||||
"lite-youtube-embed": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/lite-youtube-embed/-/lite-youtube-embed-0.2.0.tgz",
|
||||
"integrity": "sha512-XXXAk5sbvtjjwbie3XG+6HppgTm1HTGL/Uk9z9NkJH53o7puZLur434heHzAjkS60hZB3vT4ls25zl5rMiX4EA==",
|
||||
"dev": true
|
||||
},
|
||||
"load-json-file": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
||||
|
|
@ -11490,12 +11457,6 @@
|
|||
"integrity": "sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA==",
|
||||
"dev": true
|
||||
},
|
||||
"speedlify-score": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/speedlify-score/-/speedlify-score-2.0.2.tgz",
|
||||
"integrity": "sha512-FAFunl3H/faGETUX0tMh/fU0CZs5afqPR6Qm3I8xPVo9iLOZVhiDA6pUm5owXq4rSEb45y3Pf8iJqE6DmZiNvA==",
|
||||
"dev": true
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@
|
|||
"devDependencies": {
|
||||
"@netlify/plugin-a11y": "^1.0.0-beta.1",
|
||||
"@toycode/markdown-it-class": "^1.2.4",
|
||||
"artificial-chart": "^2.0.3",
|
||||
"clean-css": "^5.3.1",
|
||||
"concurrently": "^7.4.0",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
@ -47,7 +46,6 @@
|
|||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"glob": "^8.0.3",
|
||||
"html-minifier": "^4.0.0",
|
||||
"lite-youtube-embed": "^0.2.0",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^13.0.1",
|
||||
"markdown-it-abbr": "^1.0.4",
|
||||
|
|
@ -69,7 +67,6 @@
|
|||
"prettier": "^2.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"sanitize-html": "^2.7.2",
|
||||
"slugify": "^1.6.5",
|
||||
"speedlify-score": "^2.0.2"
|
||||
"slugify": "^1.6.5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,25 +2,19 @@
|
|||
title: 'Post with 301 redirects'
|
||||
description: 'Every post starts with planning. Pie tart cake halvah tiramisu macaroon chocolate marzipan pie. Jelly tootsie roll cake cake chupa chups. Shortbread tart gummi bears sweet roll!'
|
||||
date: 2022-08-28
|
||||
redirectFrom: ['/old-route/', '/optionally-another-old-route/']
|
||||
---
|
||||
|
||||
URLs usually change over time, as you use another CMS or work on your structure. A 301 is used when a page has permanently changed location. Informing about this change is indispensable if you want to keep a positioning.
|
||||
URLs usually change over time, as you use another CMS or optimiye on your file structure. A 301 is used when a page has permanently changed location. Informing about this change is indispensable if you want to keep a positioning.
|
||||
|
||||
[Aleksandr Hovhannisyan came up with a great solution for Eleventy and Netlify](https://www.aleksandrhovhannisyan.com/blog/eleventy-netlify-redirects/). To directly cover several possible obsolete routes it is created as an array.
|
||||
Aleksandr Hovhannisyan came up with a [great solution for Eleventy and Netlify](https://www.aleksandrhovhannisyan.com/blog/eleventy-netlify-redirects/). To directly cover several possible previous routes it is created as an array. You can find the loop in `_redirects.njk`.
|
||||
|
||||
## Usage
|
||||
|
||||
{% raw %}
|
||||
|
||||
```nunjucks
|
||||
_redirects.njk:
|
||||
|
||||
{% for page in collections.all %}
|
||||
{% if page.url and page.data.redirectFrom %}
|
||||
{% for oldUrl in page.data.redirectFrom %}
|
||||
{{ oldUrl }} {{ page.url }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
```yaml
|
||||
Frontmatter:
|
||||
---
|
||||
redirectFrom: ['/old-route/', '/optionally-another-old-route/']
|
||||
---
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue