Giter Club home page Giter Club logo

valaxy's Introduction

🌌 Next Generation Static Blog Framework (Beta).

🧪 Working in Progress

NPM version Release Discord

Usage

Try it Online

StackBlitz

Init Project Locally

Just run the following command to init your blog:

# pnpm (recommended)
pnpm create valaxy
# npm
# npm init valaxy
# yarn
# yarn create valaxy

For a example, you can see demo/yun folder.

Features

Dev

Want to get involved in the development? Look here.

Want to create your theme? Check valaxy-theme-starter.

Thanks

💗 The implementation of Valaxy is based on or refer the following projects:

❤️ Special thanks to the following sponsors for their support.

valaxy's People

Contributors

albteureka avatar big-cake-jpg avatar flaribbit avatar guowei-gong avatar hairyf avatar horonlee avatar jw-foss avatar kerushii avatar krau avatar linlinzzo avatar lotwt avatar mengnianxiaoyao avatar mlemoe avatar moetoo avatar nova1751 avatar okatu-loli avatar rotten-lkz avatar sepush avatar shimogawa avatar woshizhazha120 avatar wrxinyue avatar xiezongchen avatar yixiaojiu avatar yunyoujun avatar z-xl-t avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

valaxy's Issues

i18n for toc

Here is the content of an article:

---
title: Valaxy Test 文章内容测试
date: 2022-03-23
categories:
  - AAA
  - BBB
  - CCC
tags:
  - valaxy
  - 测试
  - test
---

:::zh-CN
[[toc]]

标题是一级标题

## 二级标题

### 三级标题

#### 四级标题

##### 五级标题

###### 六级标题

## 标题

## 列表测试

- AAA
- BBB
- CCC
  - DDD
    - EEE

### Checkbox

- [ ] FLAG
- [x] FLAG
:::

:::en
[[toc]]

The title is a primary title

## Secondary title

### Tertiary title

#### Level four title

##### Level five title

###### Level six title

## Title

## List title

- AAA
- BBB
- CCC
  - DDD
    - EEE

### Checkbox

- [ ] FLAG
- [x] FLAG
:::

It seems that when I type [[toc]] in article, Valaxy will render the table of contents.

But if this articles is internationlized, Valaxy will render like this:

Table of Contents

However, I expect Valaxy can render the table of contents in language which I used.

Bug: robots.txt & sitemap.xml

The robots.txt will point localhost in sitemap instead of the origin of the site, or url attribute in valaxy.config.ts

By the way, there is the same problem in sitemap.xml

robots.txt
sitemap.xml

Bug:程序无法正常启动

我 fork 了这个项目并且尝试启动,但是很可惜没有启动成功。

I don't know whether it is my fault ...

双终端开启

如果使用开启两个终端启动服务的话,pnpm dev:lib 命令可以正常启动以及运行,但是 pnpm demo 就没那么好运了。
Terminal

其实最开始运行 pnpm demo 它会提醒我找不到指令 nodemon,全局安装才能看到下一个错误。
Nodemon not found

单终端开启

在没有全局安装 nodemon 之前程序无法启动,安装后正常。

如果需要全局安装 nodemon 才能启动希望能在 README.md 稍作提示。

首页加载目录以及评论和文章自动滑动问题

  1. 在查看非第一页文章时,有时候打开文章会很慢(或者说完全打不开)。这个时候返回到选择文章的页面会发现目录以及评论在首页加载了
    Screenshot_20220424_180928_com microsoft emmx
    Screenshot_20220424_180924_com microsoft emmx

  2. 在打开文章后,不会在文章开头开始阅读。而是加载你打开该文章时的滑动进度
    注:第二个估计小云知道这个情况,但是第一个bug应该是未知的🙃

redundant render of comment components in ValaxyMain

When it doesn't need comment component, ValaxyMain still render YunCard in comment slot.

  1. ValaxyMain.vue line 49 , v-if="frontmatter.comment !== false" should bev-if="!!frontmatter.comment !== false" , because the comment property is optional.
  2. markdownToVue.ts#createMarkdownToVueRenderFn(), the property comment in the variable frontmatter is always undefined . Maybe it needs to be injected necessary properties .

feat: Themes can extend post and data information through the valve config

Post and data sometimes do not fully meet the development of custom themes, I think it would be better if there is a way to extend

example:

export function yunPlugin() {
  return {
    name: 'valaxy-theme-yun',
    enforce: 'pre',
    valaxy: {
        extendsPost(mdPath, frontmatter, excerpt) {
          frontmatter.count = readMdCount(excerpt)
          frontmatter.duration = readMdDuration(excerpt)
          // ....
        },
        extendsData(mdPath, frontmatter, excerpt) {
          // ...
        },
     }
  }
}
import { usePostList } from 'valaxy'
const posts = usePostList()
posts.value[0].count // number

feat: plugin system implementation

addon usage

array

[
  // enable
  "valaxy-addon-eee",
  // enable and option
  ["valaxy-addon-eee", {
    "options": {/* addon options */}
  }],
  // enable addon global components
  ["valaxy-addon-eee", {
    "global": true,
    "props": {/* component props */}
  }],
  // close addon
  // turn off the addon, which can be turned off at the user's discretion when the theme is enabled
  ["valaxy-addon-eee", false]
]

json

{
  // enable
  "valaxy-addon-eee": {},
  // enable and option
  "valaxy-addon-eee": {
    "options": {}
  },
  // enable addon global components
  "valaxy-addon-aaa": {
    "global": true,
    "props": {/* component props */}
  }
}

addon development

dirs

  • setup
  • App.vue
  • index.ts
  • package.json

index.ts

import { defineAddon } from 'valaxy'

export default defineAddon((addonOptions, valaxyOptions) => {
  addonOptions.global
  addonOptions.props
  addonOptions.options
  return {
    // all vite config
    vite: {},
    // markdown addon
    markdown: {}
    // other internal addon
    // ...
  }
})

package.json

Enable addon's global components, which are automatically mounted when the user installs

{
  "name": "valaxy-addon-xxx",
  "global": true
}

feat: various configurations are very confusing to use

I'm having a problem while developing a theme, there is no way to control about the vue app i.e. the app context

and because the configuration is not in the node environment, it is almost impossible to control the app conext through theme config

It is in setup/main.ts in demo, combined with valaxy.config.ts / valaxy.config.ts, or node/index.ts in theme

I find the configuration is getting more and more confusing once it's in use

For example, I want to make more extensions to app ctx in the theme, does that mean that there should be files in theme/[??].ts to control app ctx

Then the actual use will appear the following configuration

  • demo/setup/main.ts
  • demo/valaxy.config.ts
  • demo/vite.config.ts
  • theme/node/index.ts
  • theme/[app ctx??].ts

Bug: pages generation

Accessing the /links page means accessing /links html. Accessing /about means accessing /about html. Accessing /post/xxx means accessing /post/xxx html.
However, I want /xxx/xxx/index,html. In this way, almost all servers can support access pages without HTML suffix.

Bugs: Incorrect type of exported UserConfig

import type { UserConfig } from 'valaxy'
import type { ThemeUserConfig } from 'valaxy-theme-yun'

const config: UserConfig<ThemeUserConfig> = {/* ... */}

// any
config.aaa
// any
config.theme

export default config

feat: support plugins system

  • Discuss and determine the plan
  • #56
  • #58
    In order to better distinguish the responsibilities, we need to rename the configuration name of the workspace

valaxy.config.ts -> site.config.{ts|js|yml|json}

vite.config.ts -> valaxy.config.{ts|js|yml|json}

  • blog.config remains the same as before, it is still the various configurations of the blog
  • valaxy.config Will be our main configuration file, it can still optionally use yml|json, if you want more configuration (functions), user|theme can be converted to js|ts
// valaxy.config.ts
import { defineConfig } from 'valaxy'

const config = defineConfig({
    plugins: [
      // plugins settings
    ],
    vite: {},
    vue: {},
    pages: {},
    components: {},
    markdown: {},
    // ...
})

This will be the main configuration of user | theme, maybe our theme can not even need to be packaged and merged

We focus on plugins configuration

// valaxy.config.ts
import { defineConfig } from 'valaxy'
import pluginCursorEffects from 'valaxy-plugin-cursor-effects'

const config = defineConfig({
    plugins: [
      // icon settings, 
     ['valaxy-plugin-custmo-icons',  { optimize: true }]
      // string form
     'valaxy-plugin-dynamic-title',
      // function form
      pluginCursorEffects({ size: 2, zIndex: 10 }),
      // others
      'valaxy-plugin-nprogress'
    ]
})

For the plugins that have been enabled, we regard it as the reconfiguration of the plugins. For some specific plugins, we will process them first, and finally get the information of the entire plugin.

Bug: not overwrite the default config

valaxy.config.ts

I configured the sponsor item in valaxy.config.ts. Although the result is effective, it seems to be merged with the sponsorship of the default configuration.

resullt

feat: excerpt supports text reading, not rendered results

It contains too many elements, making it difficult to implement other layouts for the post

Or I can decide the way of excerpt , the framework built-in imposes constraints on me

Hope to support the effect
image

present
image

Temporary workaround
image

feat: configuration change handling

related: #56

  • user/valaxy.config.ts > user/site.config.ts
  • user/vite.config.ts > user/valaxy.config.ts
  • remove vite.valaxy
  • handling details and hot load config

other:

  • user/vite.config.ts
  • theme/vite.config.ts
  • theme/valaxy.config.ts
  • doc update(part)

Feat: the calling order of config needs to be optimized.

I think the final ViteValaxyPlugins method should be optimized to ensure that the three parties (userConfig > themeConfig > defaultConfig) are properly merged and called in sequence.

This is my irresponsible guess, but from the call flow of ViteValaxyPlugins, there is a high probability that there will still be problems

For example, using markdown.config in theme will invalidate or overwrite the markdown.config of a certain configuration

image

Feat: Provide a hook to get the current frontmatter

Get more fine-grained control over a single page

<!-- layouts/xxx.vue -->
<script setup>
import { useFrontmatter } from 'valaxy'
const frontmatter = useFrontmatter()
frontmatter.value.updated // number
</script>

or like this

<!-- layouts/xxx.vue -->
<script setup>
import { useRoute } from 'valaxy'
const route = useRoute()
route.meta.frontmatter.updated // number
</script>

安装过程报 [ERR_REQUIRE_ESM] 错误

环境
系统版本:Ubuntu 20.04.4 LTS x86
Node版本:v16.9.0
NPM版本:7.21.1
V8版本:9.3.345.16
pnpm版本:7.0.0

具体问题不知该如何描述,现象是无法通过 pnpm create valaxy 初始化项目
image

fix: the calling order of config needs to be optimized.

Source #41, dude this is too bad you should test if it actually works when you commit

image

configResolved will not be called immediately, and the plugin configuration of md plugins has already been called, which means it will not take effect

And the subsequent configuration will still not be updated

image

and all synchronous calls will not benefit from

image

Originally posted by @TuiMao233 in #41 (comment)

i18n Interaction

Following your blog post - https://valaxy.yyj.moe/posts/i18n

Wouldn't it be making more sense to have the SSG framework support the following logics:

  • Instead of supporting purely a foreign langauge version, try to think of the blog as a true i18n website; that is, some content is available under different langauges, while some others are not.
  • The owner can choose to add in an i18n version of one article, for an example, establish this version under the /en-US folder, and link it to its Chinese (native) version in the front-matter
  • The behaviour of the article would then be, remind any visitors that this article is available in other langauges; if the visitor's browser/os langauge match the langauge, an additional banner is displayed reminding the visitor that they could switch the article to their langauge
  • The ultimate site generated could have a separate /en-US branch, and all translations on localisation are applied. For an example, “首页” being translated into "Home", per mentioned in this post, and only posts available in the respective langauges are displayed

I believe this would be a better way of designing the i18n philosophy.
There are commercial practices of above ideas, such as the Apple/Microsoft website, and Microsoft Docs

Of course, these are just my immature opinions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.