您的位置:网站首页 > 动态 > 动态

在线生成个人网站(免费做小程序的网站)

2022-11-06 01:06     发布者:陈龙
导读对于 Web 开发的入门者而言,开发一个功能全面的静态的网站首页,并不是那么容易实现的需求。然而,实现一个个人网站或企业网站的简单首页,又是十分常见的需求。如果可以通过编写简单的配置文件,就能实现一个

对于 Web 开发的入门者而言,开发一个功能全面的静态的网站首页,并不是那么容易实现的需求。然而,实现一个个人网站或企业网站的简单首页,又是十分常见的需求。如果可以通过编写简单的配置文件,就能实现一个美观使用的静态首页,并能够提供一些自定义的功能,无疑会降低此类需求开发的门槛。

Homer

简介

Homer,是 bastienwirtz 在 Github 上开源的静态网站首页生成器,通过简单的 yaml 配置文件就能实现,目前版本为 v21.03.2。

Homer 使用简单,

  • 使用 yaml 格式的配置文件配置
  • 可安装 (pwa)
  • 提供搜索功能
  • 提供分组功能
  • 提供主题自定义功能
  • 提供离线 heathcheck 功能
  • 实现快捷键:/ 开始搜索,Escape 停止搜索,Enter 打开首个匹配结果,Alter/Option + Enter 在新标签开启结果

Homer

使用

Homer 是一个完全静态的 html/js 管理面板,使用 webpack 从 /src 中进行生成。Homer 需要使用一个 HTTP 服务器来提供服务。

Homer 可以使用 Docker 启动:

docker run -d 
  -p 8080:8080 
  -v :/www/assets 
  --restart=always 
  b4bz/homer:latest

默认的静态资源或被自动安装在 /www/assets 文件夹,使用 UID 和 GID 环境变量来改变资源所有者。

也可以使用 Docker-Compose 启动,配置 docker-compose.yml:

volumes:
  - /your/local/assets/:/www/assets
ports:
  - 8080:8080

启动容器,

cd /path/to/docker-compose.yml
docker-compose up -d

也可以下载预编译的 tarball 直接使用,下载 homer.zip 文件,重命名 assets/config.yml.dist 文件为 assets/config.yml:

wget http://github.com/bastienwirtz/homer/releases/latest/download/homer.zip
unzip homer.zip
cd homer
cp assets/config.yml.dist assets/config.yml
npx serve  or python -m http.server 8010 or apache, nginx ...

可以自行进行编译:

 Using yarn (recommended)
yarn install
yarn build

 **OR** Using npm
npm install
npm run build

启动后,就能看到 Homer 面板了。

Homer

Homer 最主要使用一个 yaml 格式的配置文件,一个样例的配置文件 config.yml 如下:

---
 Homepage configuration
 See http://fontawesome.com/icons for icons options

 Optional: Use external configuration file. 
 Using this will ignore remaining config in this file
 externalConfig: http://example.com/server-luci/config.yaml

title: &34;App dashboard&34;
subtitle: &34;Homer&34;
 documentTitle: &34;Welcome&34;  Customize the browser tab text
logo: &34;assets/logo.png&34;
 Alternatively a fa icon can be provided:
 icon: &34;fas fa-skull-crossbones&34;

header: true  Set to false to hide the header
footer: &39;

Created with ?? with bulma, vuejs & font awesome // Fork me on

&39; set false if you want to hide it. columns: &34;3&34; &34;auto&34; or number (must be a factor of 12: 1, 2, 3, 4, 6, 12) connectivityCheck: true whether you want to display a message when the apps are not accessible anymore (VPN disconnected for example) Optional theming theme: default &39;default&39; or one of the themes available in &39;src/assets/themes&39;. Optional custom stylesheet Will load custom CSS files. Especially useful for custom icon sets. stylesheet: - &34;assets/custom.css&34; Here is the exhaustive list of customization parameters However all value are optional and will fallback to default if not set. if you want to change only some of the colors, feel free to remove all unused key. colors: light: highlight-primary: &34;3367d6&34; highlight-secondary: &34;4285f4&34; highlight-hover: &34;5a95f5&34; background: &34;f5f5f5&34; card-background: &34;ffffff&34; text: &34;363636&34; text-header: &34;424242&34; text-title: &34;303030&34; text-subtitle: &34;424242&34; card-shadow: rgba(0, 0, 0, 0.1) link-hover: &34;363636&34; background-image: &34;assets/your/light/bg.png&34; dark: highlight-primary: &34;3367d6&34; highlight-secondary: &34;4285f4&34; highlight-hover: &34;5a95f5&34; background: &34;131313&34; card-background: &34;2b2b2b&34; text: &34;eaeaea&34; text-header: &34;ffffff&34; text-title: &34;fafafa&34; text-subtitle: &34;f5f5f5&34; card-shadow: rgba(0, 0, 0, 0.4) link-hover: &34;ffdd57&34; background-image: &34;assets/your/dark/bg.png&34; Optional message message: url: &34;http://&34; Can fetch information from an endpoint to override value below. mapping: allows to map fields from the remote format to the one expected by Homer title: &39;id&39; use value from field &39;id&39; as title content: &39;value&39; value from field &39;value&39; as content refreshInterval: 10000 Optional: time interval to refresh message Real example using chucknorris.io for showing Chuck Norris facts as messages: url: http://api.chucknorris.io/jokes/random mapping: title: &39;id&39; content: &39;value&39; refreshInterval: 10000 style: &34;is-warning&34; title: &34;Optional message!&34; icon: &34;fa fa-exclamation-triangle&34; content: &34;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&34; Optional navbar links: [] Allows for navbar (dark mode, layout, and search) without any links links: - name: &34;link 1&34; icon: &34;fab fa-github&34; url: &34;http://github.com/bastienwirtz/homer&34; target: &34;_blank&34; optional html tag target attribute - name: &34;link 2&34; icon: &34;fas fa-book&34; url: &34;http://github.com/bastienwirtz/homer&34; this will link to a second homer page that will load config from page2.yml and keep default config values as in config.yml file see url field and assets/page.yml used in this example: - name: &34;Second Page&34; icon: &34;fas fa-file-alt&34; url: &34;page2&34; Services First level array represents a group. Leave only a &34;items&34; key if not using group (group name, icon & tagstyle are optional, section separation will not be displayed). services: - name: &34;Application&34; icon: &34;fas fa-code-branch&34; A path to an image can also be provided. Note that icon take precedence if both icon and logo are set. logo: &34;path/to/logo&34; items: - name: &34;Awesome app&34; logo: &34;assets/tools/sample.png&34; Alternatively a fa icon can be provided: icon: &34;fab fa-jenkins&34; subtitle: &34;Bookmark example&34; tag: &34;app&34; url: &34;http://www.reddit.com/r/selfhosted/&34; target: &34;_blank&34; optional html tag target attribute - name: &34;Another one&34; logo: &34;assets/tools/sample2.png&34; subtitle: &34;Another application&34; tag: &34;app&34; Optional tagstyle tagstyle: &34;is-success&34; url: &34;&34; - name: &34;Other group&34; icon: &34;fas fa-heartbeat&34; items: - name: &34;Pi-hole&34; logo: &34;assets/tools/sample.png&34; subtitle: &34;Network-wide Ad Blocking&34; optional, if no subtitle is defined, PiHole statistics will be shown tag: &34;other&34; url: &34;http://192.168.0.151/admin&34; type: &34;PiHole&34; optional, loads a specific component that provides extra features. MUST MATCH a file name (without file extension) available in `src/components/services` target: &34;_blank&34; optional html a tag target attribute class: &34;green&34; optional custom CSS class for card, useful with custom stylesheet background: red optional color for card to set color directly without custom stylesheet

可以看到,提供了包括:标题、子标题、图表、主题、颜色风格、链接、子服务等配置。Homer 通过以上的配置,就能自动生成美观的主页。

Homer

总结

Homer 使用简单,使用 yaml 格式的配置文件配置,可安装,提供搜索、分组功能,可自定义主题等,使实现一个网站的静态首页变得十分简单,同时提供了美观且功能丰富的实现方案,值得使用。

Homer

免责声明:本文章由会员“陈龙”发布如果文章侵权,请联系我们处理,本站仅提供信息存储空间服务如因作品内容、版权和其他问题请于本站联系

猜你喜欢

最新文章