一次hugo折腾过程

打算换blog 使用hexo感觉有点麻烦,还要设置文章的图片,hexo搭建起来也比较费劲,尤其是ondejs 的安装也比较大,于是我换成了hugo,这是一个用go写的,部署起来很快,但是并不简单,这里面有很多坑!🤕 图片文件 之前我的所有md文件的图片都是保存到$filename这个目录,也就是md文件名生成一个同名目录,然后放入图片,typora和marktext都有这个功能;但是hugo生成的静态文件,也是把md文件名生成一个同名目录,就导致了之前的图片全部不能找到,md文件的引用到图片的地方,全部都得重写,不过还好。我使用obsidian写博客,虽然obsidian没有自带的功能,让图片文件放入md变量的目录,但是有插件(Custom Attachment Location),现在我的图片路径是./asstes/$filename,之前 obsidian那个插件的设置也要去查看文档,有点麻烦。 # 附件位置 ./assets/${noteFileName} # 附件命名 ${originalAttachmentFileName} # markdown url ./assets/${noteFileName}/${originalAttachmentFileName}.${originalAttachmentFileExtension} hugo的图片文件,只能一个一个去改。改了之后还有坑,它不支持图片的相对路径,在网上找了解决方案,就是在yaml配置文件里面加一个参数就好了。 然后就是hugo本身的问题 我是选了一个名字叫PaperMod的主题,主要就是hugo.toml这个文件的配置,生成博客之后,这个文件是空的,但是这个文件里面其实有很多需要自己配置的,否则博客有很多问题,这里我参考了主题给的demo yaml,另外在网上找了几个参数解决如下几个问题: markdown的图片不支持相对路径 博客的md不能软链接 baseURL: "https://tang895.github.io" title: TangYijun's Blog # paginate: 5 theme: papermod enableRobotsTXT: true buildDrafts: false buildFuture: false buildExpired: false # canonifyURLs: false cleanDestinationDir: true # 清理构建目录 uglyURLs: true # markdown图片可以相对路径 minify: disableXML: true minifyOutput: true # security: # # followSymlinks: true # 软链接 # exec: # allow: # - '.*' # filesystem: # allow: # - '/**' pagination: pagerSize: 5 module: mounts: source: "/Users/ian-macbook/ian-macbook-home/blog_raw/_posts/" target: "content/posts" params: env: production # to enable google analytics, opengraph, twitter-cards and schema. title: TangYijun's Blog description: "ExampleSite description" keywords: [Blog, Portfolio, PaperMod] author: Me # author: ["Me", "You"] # multiple authors images: ["<link or path of image for opengraph, twitter-cards>"] DateFormat: "January 2, 2006" defaultTheme: auto # dark, light disableThemeToggle: false ShowReadingTime: true ShowShareButtons: true ShowPostNavLinks: true ShowBreadCrumbs: true ShowCodeCopyButtons: false ShowWordCount: true ShowRssButtonInSectionTermList: true UseHugoToc: true disableSpecial1stPost: false disableScrollToTop: false comments: false hidemeta: false hideSummary: false showtoc: false tocopen: false assets: # disableHLJS: true # to disable highlight.js # disableFingerprinting: true favicon: "<link / abs url>" favicon16x16: "<link / abs url>" favicon32x32: "<link / abs url>" apple_touch_icon: "<link / abs url>" safari_pinned_tab: "<link / abs url>" label: text: "Home" icon: /apple-touch-icon.png iconHeight: 35 # profile-mode profileMode: enabled: false # needs to be explicitly set title: ExampleSite subtitle: "This is subtitle" imageUrl: "<img location>" imageWidth: 120 imageHeight: 120 imageTitle: my image buttons: - name: Posts url: posts - name: Tags url: tags # home-info mode homeInfoParams: Title: "Hi there \U0001F44B" Content: Welcome to my blog socialIcons: - name: x url: "https://x.com/" - name: stackoverflow url: "https://stackoverflow.com" - name: github url: "https://github.com/tang895" # analytics: # google: # SiteVerificationTag: "XYZabc" # bing: # SiteVerificationTag: "XYZabc" # yandex: # SiteVerificationTag: "XYZabc" cover: hidden: true # hide everywhere but not in structured data hiddenInList: true # hide on list pages and home hiddenInSingle: true # hide on single page editPost: URL: "https://github.com/<path_to_repo>/content" Text: "Suggest Changes" # edit text appendFilePath: true # to append file path to Edit link # for search # https://fusejs.io/api/options.html fuseOpts: isCaseSensitive: false shouldSort: true location: 0 distance: 1000 threshold: 0.4 minMatchCharLength: 0 limit: 10 # refer: https://www.fusejs.io/api/methods.html#search keys: ["title", "permalink", "summary", "content"] menu: main: - identifier: categories name: categories url: /categories/ weight: 10 - identifier: tags name: tags url: /tags/ weight: 20 - identifier: example name: example.org url: https://example.org weight: 30 # Read: https://github.com/adityatelange/hugo-PaperMod/wiki/FAQs#using-hugos-syntax-highlighter-chroma pygmentsUseClasses: true markup: highlight: noClasses: false # anchorLineNos: true # codeFences: true # guessSyntax: true # lineNos: true # style: monokai

November 2, 2025 · 2 min · 424 words · IanTang

记录一次manjaro设置休眠的过程

manjaro 休眠 manjaro安装之后,默认没有交换空间,不能休眠。 设置交换空间 #这里的路径以/mnt为例,即pwd = /mnt # 分配空间,8GB,根据自己电脑修改 sudo fallocate -l 8G swapfile # 设置权限 sudo chmod 600 swapfile # 设置交换区 sudo mkswap swapfile # 启用 sudo swapon swapfile #关闭方法 # sudo swapoff swapfile #添加到自启动-直接用命令 sh -c 'echo "/mnt/swapfile none swap defaults 0 0" >> /etc/fstab' #其实就是编辑/etc/fstab cat /etc/fstab 如下: 查询UUID sudo lsblk -f 记录交换空间盘的UUID 查询swapfile偏移 sudo filefrag -v /mnt/swapfile 得到的第一行就是偏移。 修改grub文件 文件地址:etc/default/grub 添加刚刚的UUID和偏移 在GRUB_CMDLINE_LINUX_DEFAULT 后面添加resume = UUID resume_offset=Offset ...

April 27, 2023 · 1 min · 111 words · IanTang

linux-manjaro下最好用的词典软件

linux-manjaro下最好用的词典软件 Linux下面有一个软件叫stardict,星际译王,在阅读pdf时,选中文字,就可以查询。但是在manjaro用起来会有很多问题。manjaro下,有一个代替的叫qstardict,可以直接pacman安装。打开软件什么都没有。 需要自己下载stardict的字典,首先需要设置stardict的字典路径: 点击之后,将stardict的路径全部删除,因为并不需要安装stardict,改为一个普通用户能访问的路径。 之后,去下载stardict的字典,网址:zh_CN 简体中文词典,将字典解压放在路径下面。 就有了字典。QStarDict设置里面的弹出窗口,可以自己设置,有选中文字直接弹出字典,选中文字按下快捷键弹出字典。以下是我自己的设置,选中文字按下快捷键弹出字典,默认Ctrl+T,因为Ctrl+T和firefox快捷键冲突。我设置了Ctrl+` 语音需要安装festival-us

April 23, 2023 · 1 min · 8 words · IanTang

linux-assembly-tutorial-att

Linux汇编-笔记-AT&T 打印Hello world .section .rodata msg: .ascii "Hello, world\n" .section .text .global _start _start: # 相当于执行 write(1, msg, 13) mov $4, %eax # 在 x86-32 下,write 的系统调用号是 1 mov $1, %edx # 第一个参数:1 是标准输出(stdout)的文件描述符 mov $msg, %ecx # 第二个参数:Hello, world 字符串的首地址(msg 标签处) mov $13, %edx # 第三个参数:要输出数据的字节数 int $0x80 # 发起系统调用 # 相当于调用 exit(0) mov $1, %eax # 在 x86-32 下,exit 的系统调用号是 1 mov $0, %ebx # 唯一的一个参数:0 int $0x80 # 发起系统调用 GNU的ld链接器默认入口符号是_start并且要将其设置为全局符号,用其他符号在链接时,使用ld -e 指定。 这里没有用到寄存器,因为是直接通过系统内核将hello world打印出来,没有调用系统函数printf,其中,用到了四个寄存器传参,他们的赋值顺序可以颠倒。 Linux系统调用号: 编译链接方法 这里是采用gas+AT&T语法写的,因此使用as编译,ld链接 因32位比较特殊,64位比较简单。这里以32位举例 编译: as --32 xxx.s -o xxx.o 链接: ld -m elf_i386 xxx.o -o xxx.out Reference 在 Linux 上用 x86-64 汇编语言写 Hello World 程序(上) | 郭帅的个人博客 linux汇编知识总结(GAS和NASM汇编)_gas 汇编_鱼日天的博客-CSDN博客 GitHub-https://github.com/cirosantilli/arm-assembly-cheat

April 23, 2023 · 1 min · 108 words · IanTang

linux-assembly-tutorial-nasm

Linux汇编-笔记-NASM 打印Hello world section .rodata hello_world db "hello world", 0x0a ;0x0a代表结束符 hello_world_len equ $ - hello_world ;长度,需要一个buffer section .text global _start _start: mov eax, 4 ;4代表sys_write mov ebx, 1 ;1代表std_out, 0代表stdin 2代表stderr mov ecx, hello_world mov edx, hello_world_len int 0x80 ;代表syswrite这个调用终止 mov eax, 1 ;代表sys_exit mov ebx, 0 ; 同上面的ebx int 0x80 ;调用终止,程序退出 GNU的ld链接器默认入口符号是_start并且要将其设置为全局符号,用其他符号在链接时,使用ld -e 指定。 这里没有用到寄存器,因为是直接通过系统内核将hello world打印出来,没有调用系统函数printf,其中,用到了四个寄存器传参,他们的赋值顺序可以颠倒。 Linux系统调用号: 编译链接方法 这里是采用nasm+intel语法写的,因此使用nasm编译,ld链接 因32位比较特殊,64位比较简单。这里以32位举例 编译: nasm -f elf32 xxx.asm 链接: ld -m elf_i386 xxx.o -o xxx.out Reference 在 Linux 上用 x86-64 汇编语言写 Hello World 程序(上) | 郭帅的个人博客 linux汇编知识总结(GAS和NASM汇编)_gas 汇编_鱼日天的博客-CSDN博客 GitHub-https://github.com/cirosantilli/arm-assembly-cheat

April 23, 2023 · 1 min · 88 words · IanTang