문제

SharePoint 2010에서 사용자 정의 CSS 및 이미지를 마스터 페이지에 넣는 위치에 대한 조언과 설명을 위해 그물을 찾고있었습니다. 나는 이제 포털을 브랜드로 바쁘게하고 있으며, CSS 파일과 이미지가 어디로 가야하는지 조금 혼란 스럽습니다.

옵션이 거의 없으며 파일을 스타일 라이브러리 (문서 라이브러리)에 포털 자체에 넣습니다. 또는 나는 그들을 하이브에 넣었다 (솔루션과 함께) 그리고 정확히 어떤 디렉토리에서 어떤 디렉토리에 있는지에있는 경우? 1033 / 스타일?(이 곳에서 나는 그 이유를 알고 싶다면 왜 1033 이유는 무엇입니까?) / 이미지? 다른 장소?

of Sourse 나는 내가 원하는 곳에서 내 파일을 넣을 수 있지만 최선의 실무 (가장 좋은 장소, 정상적인 방법)를 듣고 싶습니다.

도움이 되었습니까?

해결책

If you want a super user to be able to change logos etc, or if the logo is specific to a site collection, place them in a subfolder in /Style Library/Images/.

However often you dont want the layout files of your page, or your CSS for that matter, to be changed by end users. This is a good reason to place them somewhere in the v\TEMPLATE\LAYOUTSfolder. These files are also available across all site collections in the farm as/_LAYOUTS`.

Exactly where under LAYOUTS really depends... If they should be able to change depending on language, you should place them under each language in LAYOUTS\<LCID>\IMAGES\yourSubDir or LAYOUTS\<LCID>\STYLES\yourSubDir (you will have one folder for each language pack you have installed).

When inserting CSS use the <Sharepoint:CSSRegistration ../> web control in the master page, SharePoint will pick the relevant localized CSS file depending on the language selected by site owner or user (see my blog post for more info) and possible caveats. This will also make sure that your CSS file is not cached when it is changed.

SharePoint libraries in general have "issues" with max-age header, which would cause excessive requests to the server even though page is cached

As you state, you can put them anywhere you want, and as you can see the answer (as usual with SharePoint is "it depends"). It is not the first time we discuss this either. Check similar question here.

On a final note, they way the files end up where they do is important too! You should always use Solutions and if needed Features to provision the files no matter where you decide to stick them!

EDIT: Files that should be published in a SharePoint library must be published using a Module element in a feature. Here you want to set it to be GhostableInLibrary. Example:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="MyWelcomePageTemplate" Url="$Resources:osrvcore,List_Pages_UrlName;" Path="MyWelcomePageTemplate">
    <File Url="default.aspx" Type="GhostableInLibrary">
      <Property Name="Title" Value="My page" />
      <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx, $Resources:cmscore,PageLayout_WelcomeLinks_Title;" />
      <Property Name="ContentType" Value="MyContentType" />
    </File>
  </Module>
</Elements>

On the other hand you include LAYOUT files using Mapped Folders (directly to SharePointRoot or LAYOUT depends on your preference) that automatically is added as <RootFile ..> elements in your package/solution

다른 팁

I believe you should put all the branding design stuff in the Style Library. The 1033/Styles folder is for custom development css file.

Find out more here

Why 1033? It is Decimal Language Code for English - United States. So if you have style/images/resources that target a different language you should use the appropriate language code.

Personally I would not use the ..Styles/ ..Images/etc folders directly but I would use a subfolder in them (i.e. 1033/Styles/MyProject or 1033/Images/MyCompany). This way you can easily find your custom files in the 12 hive.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top