是否可以从git直接将markdown下载到hugo?

问题描述 投票:0回答:2

我是雨果的新手,我找不到解决这个问题的方法。

我的想法是在docker中使用hugo并从其他来源获取内容,这样hugo将得到更新。来源几乎可以是任何东西,但我希望有一个存储库。

有什么办法吗?

hugo
2个回答
0
投票

https://firepress.org/en/best-practices-for-getting-code-into-a-container/,可能是使用wget下载所需数据的选项。

也许有更好的方法,但是这似乎是完成您想要的事情的一种非常可行的方法。我从给定的示例中删除了一些“记录”功能,并添加了关于做什么的解释。

##############################################################################
# Install App
##############################################################################

WORKDIR $APP

# Some of the APK's are installed that will be removed later in this process.
RUN apk update && \
    apk upgrade && \
    apk --no-cache add tar curl tini \
    && apk --no-cache add --virtual devs gcc make python wget unzip ca-certificates \
    && apk del devs gcc make python wget unzip ca-certificates \
    && npm cache clean \
    && rm -rf /tmp/npm*


##############################################################################
# PART ONE
# Install/copy FirePress_Klimax into casper from Github
##############################################################################

#directory name, for url building and renaming the unpacked zip.
THEME_NAME_FROM="FirePress_Klimax"; \
# directory where the file should be
THEME_NAME_INTO="casper"; \

# The url where to get you data from.
GIT_URL="https://github.com/firepress-org/$THEME_NAME_FROM/archive/master.zip"; \

# Local directory names.
DIR_FROM="$DIR_THEMES/$THEME_NAME_FROM"; \
DIR_INTO="$DIR_THEMES/$THEME_NAME_INTO"; \

# enter the themes directory. 
cd $DIR_THEMES; \
# download the master.zip
wget --no-check-certificate -O master.zip $GIT_URL; \
# unzip the master.zip that was downloaded from github.
unzip $DIR_THEMES/master.zip; \   
# remove the zip file, since the contents are on disk now
rm $DIR_THEMES/master.zip; \
# rename the "master" directory that's on disk now to it's proper name
mv $THEME_NAME_FROM-master $THEME_NAME_INTO; \        

##############################################################################
# Clean up
##############################################################################
# delete the apk cache of unneeded cached downloads
rm -rf /var/cache/apk/*; \
# we don't need these programs anymore
apk del wget unzip ca-certificates;

0
投票

Hugo为您提供了内置功能Modules,该模块可用于从git中提取文件,也可以指定git repo中的哪个文件夹需要放在您的Hugo上的位置

  • 列表项

    站点。这是在构建时发生的。

您可能需要安装Go语言才能完成此工作。

© www.soinside.com 2019 - 2024. All rights reserved.