Compare commits

...

15 Commits

Author SHA1 Message Date
Elio Struyf
13cb8fcff5 Update changelog 2021-06-28 15:36:17 +02:00
Elio Struyf
4d6317f3bc 1.17.1 2021-06-28 15:35:24 +02:00
Elio Struyf
1b4ce2b925 update changelog 2021-06-28 15:35:18 +02:00
Elio Struyf
8f7f61f2af #34 - Fix date updates 2021-06-28 15:33:08 +02:00
Elio Struyf
f11b884bed #34 - Fix for last modified time on template creation 2021-06-28 14:58:08 +02:00
Elio Struyf
3a968a305f Merge pull request #37 from estruyf/dependabot/npm_and_yarn/lodash-4.17.21
Bump lodash from 4.17.19 to 4.17.21
2021-06-14 18:22:07 +02:00
dependabot[bot]
847cce915b Bump lodash from 4.17.19 to 4.17.21
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.19 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.19...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-14 16:21:16 +00:00
Elio Struyf
704d84454d 1.17.0 2021-06-14 18:20:32 +02:00
Elio Struyf
6d46762e30 #36 - added new option 2021-06-14 18:20:19 +02:00
Elio Struyf
82cf9497ae Merge pull request #32 from estruyf/dependabot/npm_and_yarn/elliptic-6.5.4
Bump elliptic from 6.5.3 to 6.5.4
2021-06-14 18:03:36 +02:00
Elio Struyf
d1563c2c23 Merge pull request #33 from estruyf/dependabot/npm_and_yarn/y18n-4.0.1
Bump y18n from 4.0.0 to 4.0.1
2021-06-14 18:03:27 +02:00
Elio Struyf
7744fdc4b2 Merge pull request #35 from estruyf/dependabot/npm_and_yarn/ssri-6.0.2
Bump ssri from 6.0.1 to 6.0.2
2021-06-14 18:03:18 +02:00
dependabot[bot]
e2042b590a Bump ssri from 6.0.1 to 6.0.2
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-30 03:05:17 +00:00
dependabot[bot]
d8ed7464a1 Bump y18n from 4.0.0 to 4.0.1
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-30 22:54:18 +00:00
dependabot[bot]
cc08ac6f53 Bump elliptic from 6.5.3 to 6.5.4
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.3 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.3...v6.5.4)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-09 16:01:01 +00:00
10 changed files with 83 additions and 6190 deletions

View File

@@ -1,5 +1,14 @@
# Change Log
## [1.17.1] - 2020-06-28
- [#34](https://github.com/estruyf/vscode-front-matter/issues/34): Fix that last modification date does not update the publication date
- [#38](https://github.com/estruyf/vscode-front-matter/issues/38): Update the last modification date on new page creation from the template
## [1.17.0] - 2020-06-14
- [#36](https://github.com/estruyf/vscode-front-matter/issues/36): Add the option to change the Front Matter its description field
## [1.16.1] - 2020-05-27
- Fix for Node.js v14.16.0

View File

@@ -139,6 +139,15 @@ Specifies the optimal description length for SEO (set to `-1` to turn it off). D
"frontMatter.taxonomy.seoDescriptionLength": 160
}
```
### `frontMatter.taxonomy.seoDescriptionLength`
Specifies the name of the SEO description field for your page. Default is `description`.
```json
{
"frontMatter.taxonomy.seoDescriptionField": "description"
}
```
### `frontMatter.taxonomy.frontMatterType`

6197
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@
"displayName": "Front Matter",
"description": "Simplifies working with front matter of your articles. Useful extension when you are using a static site generator like: Hugo, Jekyll, Hexo, NextJs, Gatsby, and many more...",
"icon": "assets/front-matter.png",
"version": "1.16.1",
"version": "1.17.1",
"preview": false,
"publisher": "eliostruyf",
"galleryBanner": {
@@ -137,6 +137,11 @@
"default": 160,
"description": "Specifies the optimal description length for SEO (set to `-1` to turn it off)."
},
"frontMatter.taxonomy.seoDescriptionField": {
"type": "string",
"default": "description",
"description": "Specifies the name of the SEO description field for your page. Default is 'description'."
},
"frontMatter.templates.folder": {
"type": "string",
"default": ".templates",

View File

@@ -101,14 +101,11 @@ export class Article {
const config = vscode.workspace.getConfiguration(CONFIG_KEY);
const dateFormat = config.get(SETTING_DATE_FORMAT) as string;
const dateField = config.get(SETTING_DATE_FIELD) as string || "date";
const modField = config.get(SETTING_MODIFIED_FIELD) as string || "date";
article = this.articleDate(article, dateFormat, dateField, forceCreate);
article = this.articleDate(article, dateFormat, modField, false);
if (typeof article.data[dateField] !== "undefined" || forceCreate) {
if (dateFormat && typeof dateFormat === "string") {
article.data[dateField] = format(new Date(), dateFormat);
} else {
article.data[dateField] = new Date();
}
}
return article;
}
@@ -133,7 +130,7 @@ export class Article {
if (dateFormat && typeof dateFormat === "string") {
article.data[dateField] = format(new Date(), dateFormat);
} else {
article.data[dateField] = new Date();
article.data[dateField] = new Date().toISOString();
}
ArticleHelper.update(editor, article);
@@ -185,4 +182,22 @@ export class Article {
article.data["draft"] = newDraftStatus;
ArticleHelper.update(editor, article);
}
/**
* Update the article date and return it
* @param article
* @param dateFormat
* @param field
* @param forceCreate
*/
private static articleDate(article: matter.GrayMatterFile<string>, dateFormat: string, field: string, forceCreate: boolean) {
if (typeof article.data[field] !== "undefined" || forceCreate) {
if (dateFormat && typeof dateFormat === "string") {
article.data[field] = format(new Date(), dateFormat);
} else {
article.data[field] = new Date().toISOString();
}
}
return article;
}
}

View File

@@ -1,4 +1,4 @@
import { SETTING_SEO_DESCRIPTION_LENGTH, SETTING_SEO_TITLE_LENGTH } from './../constants/settings';
import { SETTING_SEO_DESCRIPTION_FIELD, SETTING_SEO_DESCRIPTION_LENGTH, SETTING_SEO_TITLE_LENGTH } from './../constants/settings';
import * as vscode from 'vscode';
import { CONFIG_KEY } from '../constants';
import { ArticleHelper, SeoHelper } from '../helpers';
@@ -41,13 +41,14 @@ export class StatusListener {
const config = vscode.workspace.getConfiguration(CONFIG_KEY);
const titleLength = config.get(SETTING_SEO_TITLE_LENGTH) as number || -1;
const descLength = config.get(SETTING_SEO_DESCRIPTION_LENGTH) as number || -1;
const fieldName = config.get(SETTING_SEO_DESCRIPTION_FIELD) as string || "description";
if (article.data.title && titleLength > -1) {
SeoHelper.checkLength(editor, collection, article, "title", titleLength);
}
if (article.data.description && descLength > -1) {
SeoHelper.checkLength(editor, collection, article, "description", descLength);
if (article.data[fieldName] && descLength > -1) {
SeoHelper.checkLength(editor, collection, article, fieldName, descLength);
}
}

View File

@@ -18,6 +18,7 @@ export const SETTING_FRONTMATTER_TYPE = "taxonomy.frontMatterType";
export const SETTING_SEO_TITLE_LENGTH = "taxonomy.seoTitleLength";
export const SETTING_SEO_DESCRIPTION_LENGTH = "taxonomy.seoDescriptionLength";
export const SETTING_SEO_DESCRIPTION_FIELD = "taxonomy.seoDescriptionField";
export const SETTING_TEMPLATES_FOLDER = "templates.folder";
export const SETTING_TEMPLATES_PREFIX = "templates.prefix";

View File

@@ -11,6 +11,7 @@ export interface PanelSettings {
export interface SEO {
title: number;
description: number;
descriptionField: string;
}
export interface Slug {

View File

@@ -11,7 +11,9 @@ export const SeoStatus: React.FunctionComponent<ISeoStatusProps> = (props: React
const { data, seo } = props;
const { title, description } = data;
if (!title && !description) {
const { descriptionField } = seo;
if (!title && !data[descriptionField]) {
return null;
}
@@ -19,7 +21,7 @@ export const SeoStatus: React.FunctionComponent<ISeoStatusProps> = (props: React
<div className="seo__status">
<h3>SEO Status</h3>
{ (title && seo.title > 0) && <SeoDetails title="Title" allowedLength={seo.title} value={title} /> }
{ (description && seo.description > 0) && <SeoDetails title="Description" allowedLength={seo.description} value={description} /> }
{ (data[descriptionField] && seo.description > 0) && <SeoDetails title="Description" allowedLength={seo.description} value={data[descriptionField]} /> }
</div>
);
};

View File

@@ -1,4 +1,4 @@
import { SETTING_CUSTOM_SCRIPTS } from './../constants/settings';
import { SETTING_CUSTOM_SCRIPTS, SETTING_SEO_DESCRIPTION_FIELD } from './../constants/settings';
import * as os from 'os';
import { PanelSettings, CustomScript } from './../models/PanelSettings';
import { CancellationToken, Disposable, Uri, Webview, WebviewView, WebviewViewProvider, WebviewViewResolveContext, window, workspace, commands, env as vscodeEnv } from "vscode";
@@ -220,7 +220,8 @@ export class ExplorerView implements WebviewViewProvider, Disposable {
data: {
seo: {
title: config.get(SETTING_SEO_TITLE_LENGTH) as number || -1,
description: config.get(SETTING_SEO_DESCRIPTION_LENGTH) as number || -1
description: config.get(SETTING_SEO_DESCRIPTION_LENGTH) as number || -1,
descriptionField: config.get(SETTING_SEO_DESCRIPTION_FIELD) as string || "description"
},
slug: {
prefix: config.get(SETTING_SLUG_PREFIX) || "",