Skip to content

Commit

Permalink
Use new awesome API instead of submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
hjonin committed Jan 30, 2024
1 parent 18fc1e1 commit bc76223
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion _data/awesome
Submodule awesome deleted from a5fe09
12 changes: 12 additions & 0 deletions _data/awesome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const EleventyFetch = require("@11ty/eleventy-fetch");

module.exports = async function () {
const URL = "https://code.gouv.fr/data/awesome-codegouvfr.json";

let awesome = await EleventyFetch(URL, {
duration: "2w",
type: "json"
});

return awesome;
};
2 changes: 1 addition & 1 deletion content/fr/awesome/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ eleventyNavigation:
}) }}
<div class="fr-my-6w">
<div class="fr-grid-row fr-grid-row--gutters">
{% asyncAll filename, project in awesome.dist %}
{% asyncAll project in awesome %}
<div class="fr-col-12 fr-col-md-3">
{{ component("card", {
url: false,
Expand Down
2 changes: 1 addition & 1 deletion content/fr/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ eleventyNavigation:
}) }}
</div>
<div class="fr-col-12 fr-col-md-4">
{% set randomSourceCode = awesome.dist | values | random %}
{% set randomSourceCode = awesome | random %}
{% if randomSourceCode.logo %}
{% set randomSourceCodeImage = {
src: randomSourceCode.logo,
Expand Down
2 changes: 0 additions & 2 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ module.exports = function (eleventyConfig) {
return collection.find(post => post.fileSlug === slug);
});

eleventyConfig.addFilter("values", object => Object.values(object));

// Customize Markdown library settings:
eleventyConfig.amendLibrary("md", mdLib => {
mdLib.use(markdownItAnchor, {
Expand Down

0 comments on commit bc76223

Please sign in to comment.