mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
704d84454d | ||
|
|
6d46762e30 | ||
|
|
82cf9497ae | ||
|
|
d1563c2c23 | ||
|
|
7744fdc4b2 | ||
|
|
e2042b590a | ||
|
|
d8ed7464a1 | ||
|
|
cc08ac6f53 |
@@ -1,5 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
## [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
|
||||
|
||||
@@ -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`
|
||||
|
||||
|
||||
6177
package-lock.json
generated
6177
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -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.0",
|
||||
"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",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface PanelSettings {
|
||||
export interface SEO {
|
||||
title: number;
|
||||
description: number;
|
||||
descriptionField: string;
|
||||
}
|
||||
|
||||
export interface Slug {
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
};
|
||||
@@ -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) || "",
|
||||
|
||||
Reference in New Issue
Block a user