added content collections base config

This commit is contained in:
Nico 2022-12-22 11:18:44 +01:00
parent 23c79e579c
commit 346c154259
10 changed files with 532 additions and 20 deletions

View File

@ -0,0 +1,30 @@
---
title: "My First Blog Post"
slug: "article-1"
lang: en
pubDate: 2022-07-01
description: "This is the first post of my new Astro blog."
author: "Astro Learner"
tags: ["astro", "blogging", "learning in public"]
---
export const image = {
url: "/oui.jpg",
alt: "oui oui oui",
width: "394",
height: "512",
};
Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website.
## What I've accomplished
1. **Installing Astro**: First, I created a new Astro project and set up my online accounts.
2. **Making Pages**: I then learned how to make pages by creating new `.astro` files and placing them in the `src/pages/` folder.
3. **Making Blog Posts**: This is my first blog post! I now have Astro pages and Markdown posts!
## What's next
I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come.

View File

@ -0,0 +1,147 @@
---
title: "Access blocked Sci-hub"
subtitle: "The science of sharing."
lang: en
excerpt: "In March 2019, the Paris Regional Court ruled in favour of the publishers of scientific articles Elsevier and Springer Nature by ordering internet service providers to block access to these two websites. Here is how to access them if they are blocked in your country anyway."
tags: ["Internet", "Science"]
pubDate: "2019-10-18T07:47:36.000Z"
---
The current sci-hub address is: <a href="https://sci-hub.se" rel="noreferer noopener">sci-hub.se</a>
## What is this about?
Not being a researcher myself, heres an [extremely well done explanatory video](https://youtu.be/rcgxY__YXEc) on the subject of scientific publication (french audio with auto subtitle).
> “This is outrageous!”​
I noticed that my ISP was indeed blocking access. I have not yet been able to check for the other suppliers, but I imagine that they have all complied with the court decision.
The restriction in place is quite basic. This is a “DNS” block. A DNS is a server that is used to link a domain name: _www.sci-hub.tw_ to an IP address: _186.2.163.90_
It is, in a way, the Internet phone book. Without the address, it is impossible to contact the domain. What ISPs have certainly done: block requests to the sci-hub domain name. As a result, no IP address is returned and the site is not accessible.
## How to bypass this?
- Either by using a VPN
- Either by modifying the DNS servers of your computers/Internet box
I would recommend the second solution because it allows you to protect yourself against future blockages/filtering/censorship from your ISP and does not require any financial compensation.
I will focus on change from a computer because it will be effective wherever you are and not only from your home.
### MacOs
Go to:
1. System Preferences
1. Network
1. (wi-fi or ethernet)
1. Advanced
1. DNS
From there, you can add DNS servers by clicking the + icon. Click ok and apply the new settings. You might need to restart your computer for the changes to work.
<nuxt-img
src="https://assets.nardu.in/ef5a4b8e82a046e6a466c73c2fd9e99e.jpg"
sizes="sm:100vw xl:728px"
width="728"
height="1060"
alt="MacOS network and DNS settings"
loading="lazy">
</nuxt-img>
### Windows (10)
Go to:
1. System Settings
1. Network & Internet
1. Change adapter options
1. Right click your adapter then “properties”
1. Select “internet protocol version 4” (and/or 6)
1. Properties
1. Use the following DNS server addresses
From there, you can add DNS servers. Click save. You might need to restart your computer for the changes to work.
<picture width="728" height="319">
<nuxt-source
src="https://assets.nardu.in/sci-hub-settings.webp"
sizes="sm:100vw xl:728px" >
</nuxt-source>
<nuxt-img src="https://assets.nardu.in/sci-hub-settings.jpg"
sizes="sm:100vw xl:728px"
alt="Windows system settings"
loading="lazy" >
</nuxt-img>
</picture>
<picture width="728" height="803">
<nuxt-source
src="https://assets.nardu.in/sci-hub-network.webp"
sizes="sm:100vw xl:728px" >
</nuxt-source>
<nuxt-img src="https://assets.nardu.in/sci-hub-network.jpg"
sizes="sm:100vw xl:728px"
alt="Windows network settings"
loading="lazy" >
</nuxt-img>
</picture>
<picture width="728" height="327">
<nuxt-source
src="https://assets.nardu.in/sci-hub-adapter.webp"
sizes="sm:100vw xl:728px" >
</nuxt-source>
<nuxt-img src="https://assets.nardu.in/sci-hub-adapter.jpg"
sizes="sm:100vw xl:728px"
alt="Windows network connections settings"
loading="lazy" >
</nuxt-img>
</picture>
<picture width="728" height="434">
<nuxt-source
src="https://assets.nardu.in/sci-hub-adapter-settings.webp"
sizes="sm:100vw xl:728px" >
</nuxt-source>
<nuxt-img src="https://assets.nardu.in/sci-hub-adapter-settings.jpg"
sizes="sm:100vw xl:728px"
alt="Windows network adapter settings"
loading="lazy" >
</nuxt-img>
</picture>
## Which DNS?
There are many DNS servers available. The best known are Google, Cloudflare and OpenDNS. If you really want to use Googles, Ill let you look up their address. Here are my recommendations in order of preference.
### [FDN DNS](https://www.fdn.fr/actions/dns/)
My favorite since it is a [french association](https://www.fdn.fr/)
1. IPV4
- 80.67.169.12
- 80.67.169.40
2. IPV6
- 2001:910:800::12
- 2001:910:800::40
### [Cloudflare DNS](https://1.1.1.1/)
For those who want the [“fastest DNS servers in the world”.](https://www.dnsperf.com/#!dns-resolvers)
1. IPV4
- 1.1.1.1
- 1.0.0.1
2. IPV6
- 2606:4700:4700::1111
- 2606:4700:4700::1001
## That's it.
By changing these settings, you are free from your ISPs and their content filtering rules.
For the moment, these restrictions are almost symbolic because if Sci-hub were to change its url, the block would no longer work. But the publishers victory in court shows that they have not had their last word. We are therefore not immune to a wider and stronger block in the future.
If you want to learn more about the struggle of the people who fight to ensure that research is not a paid commodity, I recommend [this documentary](https://youtu.be/y_CQATGOX2w) on Aaron Shwartz. Or [this article](https://arstechnica.com/tech-policy/2016/04/a-spiritual-successor-to-aaron-swartz-is-angering-publishers-all-over-again/) about the founder of Sci-hub.
In the meantime, good readings to all of you. We stand with you!

View File

@ -0,0 +1,30 @@
---
title: "Sci-Hub EN"
slug: "sci-hub"
lang: en
pubDate: 2022-10-11
description: "This is the first post of my new Astro blog."
author: "Astro Learner"
tags: ["astro", "blogging", "learning in public"]
---
export const image = {
url: "/oui.jpg",
alt: "oui oui oui",
width: "394",
height: "512",
};
Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website.
## What I've accomplished
1. **Installing Astro**: First, I created a new Astro project and set up my online accounts.
2. **Making Pages**: I then learned how to make pages by creating new `.astro` files and placing them in the `src/pages/` folder.
3. **Making Blog Posts**: This is my first blog post! I now have Astro pages and Markdown posts!
## What's next
I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come.

View File

@ -0,0 +1,18 @@
---
title: "Mon premier article"
slug: "article-1"
lang: fr
pubDate: 2022-07-01
description: "youpi"
author: "Astro Learner"
tags: ["astro", "blogging", "learning in public"]
---
export const image = {
url: "/oui.jpg",
alt: "oui oui oui",
width: "394",
height: "512",
};
Bienvenue les men in black

View File

@ -0,0 +1,150 @@
---
title: "Sci-hub bloqué, comment contourner"
subtitle: "La science du partage."
lang: fr
excerpt: "Le tribunal de grande instance de Paris a ordonné aux fournisseurs daccès à internet de bloquer laccès à sci-hub. Voici comment contourner les blocages mis en place."
tags: ["Internet", "Science"]
pubDate: "2019-03-31T07:47:36.000Z"
---
L'adresse actuelle de sci-hub est&nbsp;: [sci-hub.se](https://sci-hub.se)
## Résumé de la situation
Nétant pas moi-même directement chercheur, je vous laisse regarder [cette vidéo](https://youtu.be/rcgxY__YXEc) explicative extrêmement bien faite sur le sujet de la publication scientifique.
> “ Mais cest scandaleux ! ”​
Jai constaté que le blocage était actif chez SFR. Je nai pas encore pu vérifier pour les autres fournisseurs mais jimagine quils se sont tous conformés à la décision de justice.
Le blocage mis en place est assez basique. Il sagit dun blocage “ DNS ”.
Un DNS est un serveur qui sert à faire le lien entre un nom de domaine&nbsp;: **sci-hub.tw** et une adresse IP : **186.2.163.90**.
Cest en quelque sorte lannuaire dinternet. Sans ladresse, impossible de contacter le domaine. Ce que les FAI ont certainement fait&nbsp;: bloquer les requêtes au nom de domaine [sci-hub.tw.](http://sci-hub.tw/) Ainsi, aucune adresse IP nest renvoyée et le site nest pas accessible.
## Comment contourner ce blocage&nbsp;?
- Soit en utilisant un VPN
- Soit en modifiant les serveurs DNS de vos ordinateurs/box internet
Je recommande la deuxième solution car elle permet de se prémunir contre de futurs blocages/filtrages/censures de la part de votre FAI et ne nécessite pas de contrepartie financière.
Je vais me focaliser sur le changement depuis un ordinateur car il sera effectif où que vous soyez.
### Sur MacOs&nbsp;:
Ouvrez&nbsp;:
1. Préférences système
1. Réseau
1. Avancé
1. DNS
1. Serveurs DNS
De là, vous pouvez ajouter des serveurs DNS en cliquant sur l'icône +. Cliquez sur ok et appliquez les nouveaux paramètres. Vous devrez peut-être redémarrer votre ordinateur pour que les changements fonctionnent.
<nuxt-img
src="https://assets.nardu.in/ef5a4b8e82a046e6a466c73c2fd9e99e.jpg"
sizes="sm:100vw xl:728px"
width="728"
height="1060"
alt="MacOS réglages réseau et DNS"
loading="lazy">
</nuxt-img>
### Sur Windows (ici 10)&nbsp;:
Ouvrez&nbsp;:
1. Réglages
1. Réseau et internet
1. Modifier les options de l'adaptateur
1. Clic droit sur les propriétés de votre interface réseau
1. Selectionnez «&nbsp;protocole Internet version 4&nbsp;» (et/ou 6)
1. Propriétés
1. Utiliser ladresse de serveur DNS suivante
<picture width="728" height="319">
<nuxt-source
src="https://assets.nardu.in/sci-hub-settings.webp"
sizes="sm:100vw xl:728px" >
</nuxt-source>
<nuxt-img src="https://assets.nardu.in/sci-hub-settings.jpg"
sizes="sm:100vw xl:728px"
alt="Réglages windows"
loading="lazy" >
</nuxt-img>
</picture>
<picture width="728" height="803">
<nuxt-source
src="https://assets.nardu.in/sci-hub-network.webp"
sizes="sm:100vw xl:728px" >
</nuxt-source>
<nuxt-img src="https://assets.nardu.in/sci-hub-network.jpg"
sizes="sm:100vw xl:728px"
alt="Windows réglages réseaux"
loading="lazy" >
</nuxt-img>
</picture>
<picture width="728" height="327">
<nuxt-source
src="https://assets.nardu.in/sci-hub-adapter.webp"
sizes="sm:100vw xl:728px" >
</nuxt-source>
<nuxt-img src="https://assets.nardu.in/sci-hub-adapter.jpg"
sizes="sm:100vw xl:728px"
alt="Windows régalges connections réseaux"
loading="lazy" >
</nuxt-img>
</picture>
<picture width="728" height="434">
<nuxt-source
src="https://assets.nardu.in/sci-hub-adapter-settings.webp"
sizes="sm:100vw xl:728px" >
</nuxt-source>
<nuxt-img src="https://assets.nardu.in/sci-hub-adapter-settings.jpg"
sizes="sm:100vw xl:728px"
alt="Windows options adaptateur réseau"
loading="lazy" >
</nuxt-img>
</picture>
## Quels serveurs DNS utiliser&nbsp;?
Il y a de nombreux serveurs DNS accessibles. Les plus connus étant ceux de Google, Cloudflare et OpenDNS. Si vous tenez vraiment à utiliser ceux de Google, je vous laisse chercher leur adresse. Voici mes recommandations par ordre de préférence.
Plusieurs fournisseurs :
### [FDN DNS](https://www.fdn.fr/actions/dns/)
Mes favoris puisquil sagit dune [association française.](https://www.fdn.fr/)
1. IPV4
- 80.67.169.12
- 80.67.169.40
2. IPV6
- 2001:910:800::12
- 2001:910:800::40
### [Cloudflare DNS](https://1.1.1.1/)
Pour ceux qui veulent les serveurs DNS [“&nbsp;les plus rapides du monde&nbsp;”.](https://www.dnsperf.com/#!dns-resolvers)
1. IPV4
- 1.1.1.1
- 1.0.0.1
2. IPV6
- 2606:4700:4700::1111
- 2606:4700:4700::1001
## C'est tout.
En modifiant ces réglages, vous vous affranchissez de vos fournisseurs daccès et de leurs règles de filtrage du contenu.
Pour linstant, ces blocages sont presque symboliques car si Sci-hub venait à changer durl, le blocage ne fonctionnerait plus. Mais la victoire des éditeurs au tribunal montre quils nont pas dit leur dernier mot. Nous ne sommes donc pas à labri dun futur blocage plus large et plus dur à contrer.
Si vous voulez en apprendre plus sur le combat de ces gens qui se battent pour que la recherche ne soit pas une marchandise, je vous conseille [ce documentaire](https://youtu.be/y_CQATGOX2w) sur Aaron Shwartz. Ou plus simplement [cet article](https://arstechnica.com/tech-policy/2016/04/a-spiritual-successor-to-aaron-swartz-is-angering-publishers-all-over-again/) sur la fondatrice de Sci-hub.
En attendant, bonnes lectures à tou·te·s. On est avec vous !

View File

@ -0,0 +1,30 @@
---
title: "Sci-Hub FR"
slug: "sci-hub"
lang: fr
pubDate: 2022-10-11
description: "This is the first post of my new Astro blog."
author: "Astro Learner"
tags: ["astro", "blogging", "learning in public"]
---
export const image = {
url: "/oui.jpg",
alt: "oui oui oui",
width: "394",
height: "512",
};
Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website.
## What I've accomplished
1. **Installing Astro**: First, I created a new Astro project and set up my online accounts.
2. **Making Pages**: I then learned how to make pages by creating new `.astro` files and placing them in the `src/pages/` folder.
3. **Making Blog Posts**: This is my first blog post! I now have Astro pages and Markdown posts!
## What's next
I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come.

26
src/content/config.ts Normal file
View File

@ -0,0 +1,26 @@
import { z, defineCollection } from "astro:content";
const articles = defineCollection({
slug: ({ defaultSlug, data }) => {
// Use `permalink` from the entrys frontmatter as the slug, if it exists.
// Otherwise, fall back to the default slug.
return data.slug || defaultSlug;
},
schema: {
title: z.string(),
subtitle: z.string(),
lang: z.enum(["fr", "en"]),
slug: z.string().optional(),
tags: z.array(z.string()), // An array of strings
// Parse pubDate as a browser-standard `Date` object
pubDate: z
.string()
.transform((str) => new Date(str))
.optional(),
},
});
export const collections = {
// Don't forget 'quotes' for collection names containing dashes
articles,
};

93
src/content/types.generated.d.ts vendored Normal file
View File

@ -0,0 +1,93 @@
declare module 'astro:content' {
export { z } from 'astro/zod';
export type CollectionEntry<C extends keyof typeof entryMap> =
typeof entryMap[C][keyof typeof entryMap[C]] & Render;
type BaseCollectionConfig<S extends import('astro/zod').ZodRawShape> = {
schema?: S;
slug?: (entry: {
id: CollectionEntry<keyof typeof entryMap>['id'];
defaultSlug: string;
collection: string;
body: string;
data: import('astro/zod').infer<import('astro/zod').ZodObject<S>>;
}) => string | Promise<string>;
};
export function defineCollection<S extends import('astro/zod').ZodRawShape>(
input: BaseCollectionConfig<S>
): BaseCollectionConfig<S>;
export function getEntry<C extends keyof typeof entryMap, E extends keyof typeof entryMap[C]>(
collection: C,
entryKey: E
): Promise<typeof entryMap[C][E] & Render>;
export function getCollection<
C extends keyof typeof entryMap,
E extends keyof typeof entryMap[C]
>(
collection: C,
filter?: (data: typeof entryMap[C][E]) => boolean
): Promise<(typeof entryMap[C][E] & Render)[]>;
type InferEntrySchema<C extends keyof typeof entryMap> = import('astro/zod').infer<
import('astro/zod').ZodObject<Required<ContentConfig['collections'][C]>['schema']>
>;
type Render = {
render(): Promise<{
Content: import('astro').MarkdownInstance<{}>['Content'];
headings: import('astro').MarkdownHeading[];
injectedFrontmatter: Record<string, any>;
}>;
};
const entryMap: {
"articles": {
"en/post-0.mdx": {
id: "en/post-0.mdx",
slug: "en/post-0",
body: string,
collection: "articles",
data: any
},
"en/sci-hub-blocage.md": {
id: "en/sci-hub-blocage.md",
slug: "en/sci-hub-blocage",
body: string,
collection: "articles",
data: any
},
"en/sci-hub.mdx": {
id: "en/sci-hub.mdx",
slug: "en/sci-hub",
body: string,
collection: "articles",
data: any
},
"fr/post-0.mdx": {
id: "fr/post-0.mdx",
slug: "fr/post-0",
body: string,
collection: "articles",
data: any
},
"fr/sci-hub-blocage.md": {
id: "fr/sci-hub-blocage.md",
slug: "fr/sci-hub-blocage",
body: string,
collection: "articles",
data: any
},
"fr/sci-hub.mdx": {
id: "fr/sci-hub.mdx",
slug: "fr/sci-hub",
body: string,
collection: "articles",
data: any
},
},
};
type ContentConfig = never;
}

View File

@ -6,7 +6,6 @@ astroI18n.init(Astro);
// import stuff
import BaseLayout from "../layouts/BaseLayout.astro";
import QuickAccessCard from "../components/QuickAccessCard.astro";
import CardEditorial from "../components/CardEditorial.astro";
import ListCards from "../components/ListCards.astro";
const pageTitle = t("accueil");
@ -28,6 +27,13 @@ const localizedArticles = allArticles.filter((article) => {
const sortedArticles = localizedArticles.sort(
(a, b) => b.frontmatter.pubDate - a.frontmatter.pubDate
);
// New astro content collections
import { getCollection } from "astro:content";
// Only return posts with `draft: true` in the frontmatter
const newLocalizedArticles = await getCollection("articles", ({ data }) => {
return data.lang === astroI18n.langCode;
});
---
<BaseLayout pageTitle={pageTitle}>
@ -71,7 +77,7 @@ const sortedArticles = localizedArticles.sort(
<section class="latest">
<div class="latest__work">
<h2>{t("index.latestArticles")}</h2>
<ListCards list={sortedArticles} routeName={t("article.titre")} />
<ListCards list={newLocalizedArticles} routeName={t("article.titre")} />
</div>
</section>
</BaseLayout>

View File

@ -1,18 +0,0 @@
/* @import "open-props/style"; */
/* @import "open-props/normalize"; */
@import "./global/reset.css";
@import "./global/fonts.css";
@import "./global/variables.css";
@import "./global/global-styles.css";
@import "./compositions/grid.css";
@import "./compositions/sidebar.css";
@import "./utilities/flow.css";
@import "./utilities/region.css";
@import "./utilities/wrapper.css";
/* @import-glob './blocks/*.css'; */
/* @import-glob './compositions/*.css'; */
/* @import-glob './utilities/*.css'; */