Skip to content

Commit

Permalink
Merge pull request OlegShchavelev#4 from Ampernic/main
Browse files Browse the repository at this point in the history
"GNOME Apps" section - Fix locale-dependent frontmatter generation
  • Loading branch information
OlegShchavelev authored Jul 14, 2024
2 parents 815ecd2 + 792be6e commit 6d0c50f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .vitepress/theme/components/AMWGnomeAppCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const { localeIndex, theme } = useData()
const config = theme.value.asideMeta
import { getLinks, getKeywords } from '../composables/asidemeta'
console.log(localeIndex.value)
const props = defineProps({
app: Object
})
Expand All @@ -29,7 +27,7 @@ const cardProps = computed(() => {
icon: icon,
name: name,
summary: summary,
links: getLinks({ ...repos, ...{ about_app: withBase(`${localeIndex.value!=='root'?'/'+localeIndex.value+'/':''}${props.app.about_app}`) }, snap: undefined }, config.links),
links: getLinks({ ...repos, ...{ about_app: withBase(props.app.about_app) }, snap: undefined }, config.links),
keywords: getKeywords([...is_adaptive, ...is_donttheme], config.keywords)
}
})
Expand Down
13 changes: 10 additions & 3 deletions .vitepress/theme/components/AMWGnomeAppsList.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
<script setup>
import { useData } from 'vitepress'
import AGWGnomeAppCard from './AMWGnomeAppCard.vue'
import { data as apps } from '../loaders/appsGnomeDataLoader.data.ts'
import { data as appsRoot } from '../loaders/appsGnomeRootDataLoader.data.ts'
import { data as appsEN } from '../loaders/appsGnomeEnDataLoader.data.ts'
const { frontmatter } = useData()
const { frontmatter, localeIndex } = useData()
const props = defineProps({
category: String
})
const apps = {
'root': appsRoot,
'en': appsEN
}
const getAppsList = () => {
const rawWikiApps = apps.filter((app) => {
const rawWikiApps = apps[localeIndex.value].filter((app) => {
return app?.frontmatter?.appstream?.keywords?.includes(props?.category)
})
Expand Down
13 changes: 13 additions & 0 deletions .vitepress/theme/loaders/appsGnomeEnDataLoader.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createContentLoader } from 'vitepress'

export default createContentLoader('en/apps/**/index.md', {
transform(rawData) {
return rawData.filter((app) => {
return (
app?.frontmatter?.appstream?.keywords?.includes('core') ||
app?.frontmatter?.appstream?.keywords?.includes('circle') ||
app?.frontmatter?.appstream?.keywords?.includes('dev')
)
})
}
})
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContentLoader } from 'vitepress'

export default createContentLoader('apps/**/*.md', {
export default createContentLoader('apps/**/index.md', {
transform(rawData) {
return rawData.filter((app) => {
return (
Expand Down

0 comments on commit 6d0c50f

Please sign in to comment.