Fix 'featured' flag to ignore items on the homepage
This commit is contained in:
@@ -45,6 +45,9 @@ Following front-matter attributes are possible:
|
|||||||
* **ring**: Ring section in radar. One of `trial`, `assess`, `adopt`, `hold`
|
* **ring**: Ring section in radar. One of `trial`, `assess`, `adopt`, `hold`
|
||||||
* **info**: (optional) A short textual description of the item (visible in
|
* **info**: (optional) A short textual description of the item (visible in
|
||||||
overview pages)
|
overview pages)
|
||||||
|
* **featured**: (optional, default "true") If you set this to `false`, the item
|
||||||
|
will not be visibile on the homepage anymore but still available in the radar
|
||||||
|
overview.
|
||||||
|
|
||||||
The name of the .md file acts as item identifier and may overwrite items with
|
The name of the .md file acts as item identifier and may overwrite items with
|
||||||
the same name from older releases.
|
the same name from older releases.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export const featuredOnly = items => items.filter(item => item.isFeatured);
|
export const featuredOnly = items => items.filter(item => item.featured);
|
||||||
|
|
||||||
export const groupByQuadrants = items =>
|
export const groupByQuadrants = items =>
|
||||||
items.reduce(
|
items.reduce(
|
||||||
|
|||||||
@@ -113,10 +113,17 @@ const createItems = revisions => {
|
|||||||
return Object.values(itemMap).sort((x, y) => (x.name > y.name ? 1 : -1));
|
return Object.values(itemMap).sort((x, y) => (x.name > y.name ? 1 : -1));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ignoreEmptyRevisionBody = (revision, item) => {
|
||||||
|
if (!revision.body || revision.body.trim() === '') {
|
||||||
|
return item.body;
|
||||||
|
}
|
||||||
|
return revision.body;
|
||||||
|
};
|
||||||
|
|
||||||
const addRevisionToItem = (
|
const addRevisionToItem = (
|
||||||
item = {
|
item = {
|
||||||
flag: 'default',
|
flag: 'default',
|
||||||
isFeatured: true,
|
featured: true,
|
||||||
revisions: [],
|
revisions: [],
|
||||||
},
|
},
|
||||||
revision,
|
revision,
|
||||||
@@ -125,6 +132,7 @@ const addRevisionToItem = (
|
|||||||
let newItem = {
|
let newItem = {
|
||||||
...item,
|
...item,
|
||||||
...rest,
|
...rest,
|
||||||
|
body: ignoreEmptyRevisionBody(rest, item),
|
||||||
attributes: {
|
attributes: {
|
||||||
...item.attributes,
|
...item.attributes,
|
||||||
...revision.attributes,
|
...revision.attributes,
|
||||||
|
|||||||
3
radar/2017-10-01/typo3-as-a-framework.md
Normal file
3
radar/2017-10-01/typo3-as-a-framework.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
featured: false
|
||||||
|
---
|
||||||
Reference in New Issue
Block a user